Java8中的常見函數式接口

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>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章