原文链接:java8 中的常用函数式接口
函数式接口 | 表达式 | 拓展 | 备注 |
---|---|---|---|
Predicate |
T -> boolean | DoublePredicate IntPredicate LongPredicate | 谓词 |
Consumer |
T -> void | DoubleConsumer IntConsumer LongConsumer | 消费 |
Function<T, R> | T -> R | DoubleFunction<R> DoubleToIntFunction DoubleToLongFunction IntFunction<R> IntToDoubleFunction IntToLongFunction LongFunction<R> LongToDoubleFunction LongToIntFunction ToDoubleFunction<T> ToIntFunction<T> ToLongFunction<T> | 类型转换 |
Supplier |
() -> T | BooleanSupplier DoubleSupplier IntSupplier LongSupplier | 生产 |
UnaryOperator |
T -> T | IntUnaryOperator LongUnaryOperator | 一元运算符 |
BinaryOperator |
(T, T) -> T | DoubleBinaryOperator IntBinaryOperator LongBinaryOperator | 二元运算符 |
BiPredicate<T, U> | (T, U) -> boolean | 扩展Predicate | |
BiConsumer<T, U> | (T, U) -> void | ObjDoubleConsumer<T> ObjIntConsumer<T> ObjLongConsumer<T> | 扩展Consumer |
BiFunction<T, U, R> | (T, U) -> R | ToDoubleBiFunction<T, U> ToIntBiFunction<T, U> ToLongBiFunction<T, U> | 扩展Function |