/**
* JDK8新特性☞Function接口測試 Function接口有一個參數並且返回一個結果,並附帶一些和其他函數組合的默認方法
*
* @author Administrator
*
*/
public class Test1 {
public static void main(String[] args) {
Function<Integer, String> function = String::valueOf;
Function<Integer, Integer> then = function.andThen(Integer::valueOf);
Integer apply = then.apply(123);
System.out.println(apply);
}
* JDK8新特性☞Function接口測試 Function接口有一個參數並且返回一個結果,並附帶一些和其他函數組合的默認方法
*
* @author Administrator
*
*/
public class Test1 {
public static void main(String[] args) {
Function<Integer, String> function = String::valueOf;
Function<Integer, Integer> then = function.andThen(Integer::valueOf);
Integer apply = then.apply(123);
System.out.println(apply);
}
}
測試結果
123