Java8 中的常用函数式接口
内容来自于《Java8实战》
函数式接口 | 函数描述符 | 原始类型特化 |
---|---|---|
Predicate | T->boolean | IntPredicate, LongPredicate, DoublePredicate |
Consumer | T->void | IntConsumer, LongConsumer, DoubleConsumer |
Function<T, R> | T->R | IntFunction, IntToDoubleFunction, IntToLongFunction, LongFunction,, LongToDoubleFunction, LongToIntFunction, DoubleFunction, ToIntFunction, ToDoubleFunction, ToLongFunction |
Supplier | ()->T | BooleanSupplier, IntSupplier, LongSupplier, DoubleSupplier |
UnaryOperator | T->T | IntUnaryOperator, LongUnaryOperator, DoubleUnaryOperator |
BinaryOperator | (T, T)->T | IntBinaryOperator, LongBinaryOperator, DoubleBinaryOperator |
BiPredicate<L, R> | (L, R)->boolean | |
BiConsumer<T, U> | (T, U)->void | ObjIntConsumer, ObjLongConsumer, ObjDoubleConsumer |
BiFunction<T, U, R> | (T, U)->R | ToIntBiFunction<T, U>, ToLongBiFunction<T, U>, ToDoubleBiFunction<T, U> |