您的位置:首页 > 编程语言 > Java开发

JDK8-函数式接口

2016-11-04 09:51 211 查看

返回类型为void的函数

TYPE OF FUNCTIONLAMBDA EXPRESSIONKNOWN FUNCTIONAL
INTERFACES
Nullary() -> doSomething()Runnable
Unaryfoo -> 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
Unaryn -> n + 1 n -> n >= 0Function
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 == 0Comparator
BiFunction
ToIntBiFunction
ToLongBiFunction
ToDoubleBiFunctionBinaryOperator
IntBinaryOperator
LongBinaryOperator
DoubleBinaryOperatorBiPredicate
n-ary(x,y,z) -> 2 * x + Math.sqrt(y) – zDefine your own
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: