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);
}
执行结果: