-
四大函数式接口
-
消费型接口 :
Consumer<T> void accept(T t)
-
供给型接口:
Supplier<T> T get();
-
函数型接口:
Function<T,R> R apply(T t); -
断言型接口:
Predicateboolean test(T t);
-
拓展:
-
BiFunction<T,U,R> R apply(T t, U u);
-
UnaryOperator
(Function 子接口) T apply(T t); -
BinaryOperator
(Function 子接口 T apply(T t1, T t2);
4, BiConsumer<T,U> void accept(T t, U u);
-
ToIntFunction
计算int值的函数 返回int -
ToDoubleFunction
计算double值的函数 返回double -
ToLongFunction
计算long值的函数 返回long -
LongFunction
参数为long类型的函数 返回 R -
IntFunction
参数为int类型的函数 返回 R -
DoubleFunction
参数为double类型的函数 返回 R
其他常见的函数式接口:
public interface Runnable { void run(); }
public interface Callable
public interface Comparator