简单的函数式接口测试

package t1;

public class Lambda {

public static void main(String[] args) {
Functiuon<Integer, Integer> square = x -> x * x;
Functiuon<Integer, Integer> trip = x -> x * 3;
System.out.println(square.apply(2));
System.out.println(trip.apply(2));
}

}

interface Functiuon<T, U> {

U apply(T t);
}

 

执行结果:

 

posted @ 2020-03-26 11:18  工设091  阅读(243)  评论(0)    收藏  举报