import
com.google.common.base.Function;
import
com.google.common.collect.Lists;
import
java.util.*;
import
java.util.stream.*;
class
GFG {
public
static
<T, U> List<U>
convertIntListToStringList(List<T> listOfInteger,
Function<T, U> function)
{
return
Lists.transform(listOfInteger, function);
}
public
static
void
main(String args[])
{
List<Integer> listOfInteger = Arrays.asList(
1
,
2
,
3
,
4
,
5
);
System.out.println(
"List of Integer: "
+ listOfInteger);
List<String> listOfString = convertIntListToStringList(
listOfInteger,
s -> String.valueOf(s));
System.out.println(
"List of String: "
+ listOfString);
}
}