jdk自带的函数式接口(配合lambda使用)

dk为lambda表达式已经内置了丰富的函数式接口,如下表所示(仅列出部分):
函数式接口            函数描述符                    原始类型特化
Predicate<T>        T -> boolean         IntPredicate, LongPredicate, DoublePredicate
Consumer<T>         T -> void            IntConsumer, LongConsumer, DoubleConsumer
Funcation<T, R>     T -> R               IntFuncation<R>, IntToDoubleFunction, IntToLongFunction<R>, LongFuncation…
Supplier<T>         () -> T               BooleanSupplier, IntSupplier, LongSupplier, DoubleSupplier
UnaryOperator<T>    T -> T                IntUnaryOperator, LongUnaryOperator, DoubleUnaryOperator
BinaryOperator<T>    (T, T) -> T           IntBinaryOperator, LongBinaryOperator, DoubleBinaryOperator
BiPredicate<L, R>    (L, R) -> boolean    
BiConsumer<T, U>     (T, U) -> void    
BiFunction<T, U, R>    (T, U) -> R
posted @ 2018-08-10 18:37  zohy  阅读(276)  评论(0编辑  收藏  举报