Java examples for Lambda Stream:Function
applying the Function to each element of the original List
import java.util.ArrayList; import java.util.List; import java.util.function.Function; public class Main { public static <T, U> List<U> map(List<T> list, Function<? super T, ? extends U> f) { List<U> rlt = new ArrayList<>(); list.forEach(t -> rlt.add(f.apply(t))); return rlt;//from w ww . ja v a 2 s . c om } }