Java >> Guava >> Function
List inputList = Arrays.asList("Hi There", "I am", "testing functions
//This function can transform a string to a list of string splitted by spaces
Function<String, String[]> splitByWords = new Function<String, String[]>(){
public String[] apply(String input) {
return input.split(" ");
}};
//The method Collections2.transform can turn a list to another list by applying a function
Collection<String[]> wordsList = Collections2.transform(inputList, splitByWords);
Source: http://javarticles.com/2015/11/guava-functions-example.html
Function<I, O> is a simple interface with method called apply(input) that takes in an input and returns an output