JDK8-函数式接口

返回类型为void的函数

TYPE OF FUNCTION LAMBDA EXPRESSION KNOWN FUNCTIONAL
 INTERFACES
Nullary () -> doSomething() Runnable
Unary foo  -> System.out.println(foo) Consumer
IntConsumer
LongConsumer
DoubleConsumer
Binary (console,text) -> console.print(text) BiConsumer
ObjIntConsumer
ObjLongConsumer
ObjDoubleConsumer
n-ary (sender,host,text) -> sender.send(host, text) Define your own

 

返回类型为T的函数

 

TYPE OF
FUNCTION
LAMBDA
EXPRESSION
KNOWN FUNCTIONAL 
INTERFACES
Nullary () -> ”Hello World” Callable
Supplier
BooleanSupplier
IntSupplier
LongSupplier
DoubleSupplier
Unary n -> n + 1 n -> n >= 0 Function
IntFunction
LongFunction
DoubleFunctionIntToLongFunction
IntToDoubleFunction
LongToIntFunction
LongToDoubleFunction
DoubleToIntFunction
DoubleToLongFunctionUnaryOperator
IntUnaryOperator
LongUnaryOperator
DoubleUnaryOperatorPredicate
IntPredicate
LongPredicate
DoublePredicate
Binary (a,b) -> a > b ? 1 : 0(x,y) -> x + y (x,y) -> x % y == 0 Comparator
BiFunction
ToIntBiFunction
ToLongBiFunction
ToDoubleBiFunctionBinaryOperator
IntBinaryOperator
LongBinaryOperator
DoubleBinaryOperatorBiPredicate
n-ary (x,y,z) -> 2 * x + Math.sqrt(y) – z Define your own

 

posted @ 2016-11-04 09:51  登高一呼  阅读(625)  评论(0编辑  收藏  举报