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> |