Java tutorial
//package com.java2s; /* * This class was created by <AdrianTodt>. It's distributed as * part of the DavidBot. Get the Source Code in github: * https://github.com/adriantodt/David * * DavidBot is Open Source and distributed under the * GNU Lesser General Public License v2.1: * https://github.com/adriantodt/David/blob/master/LICENSE * * File Created @ [01/11/16 13:07] */ import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; public class Main { public static <T, R> List<R> apply(List<T> list, Function<T, R> mapper) { return list.stream().map(mapper).collect(Collectors.toList()); } }