JDK8-函数式接口
2016-11-04 09:51
211 查看
返回类型为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 |
相关文章推荐
- JDK8 注解:函数式接口@FunctionalInterface
- JDK8新特性:函数式接口@FunctionalInterface的使用说明
- 第十八讲 二叉树、JDK8函数式接口、File类、输入流与输出流、字节流与字符流、文件复制的实现
- JDK8 函数式接口
- JDK8新特性:函数式接口@FunctionalInterface的使用说明
- JDK8新特性之函数式接口
- jdk8 函数式接口
- jdk8特性例子 内置函数式接口
- JDK8新特性之函数式接口
- JDK8新特性学习(一) Lambda表达式和函数式接口
- jdk8新特性:Lambda表达式(也称为闭包、可传递的匿名函数)与函数式接口@FunctionalInterface
- jdk8函数式接口,SAM类型的接口(Single Abstract Method)
- 第二十三讲 JDK8的foreach与Consumer接口、四大核心函数式接口、Stream接口、队列与栈
- JDK8-四大核心函数式接口(三)
- java8学习之Function与BiFunction函数式接口详解
- java8 函数式接口(FunctionalInterface) [一]
- 【转】Java8学习笔记(1) -- 从函数式接口说起
- Java 8 函数式接口
- Java 8 函数式接口 - Functional Interface
- Java8的四种函数式接口