Function01.java
01 package com.test03;
02
03 import java.util.function.BinaryOperator;
04 import java.util.function.UnaryOperator;
05
06 public class Function01 {
07
08 public static void main(String[] args) {
09 unaryTest();
10 binaryTest();
11
12 }
13
14 private static void binaryTest() {
15 BinaryOperator<Integer> sum = (i, j) -> i + j;
16 System.out.println(sum.apply(10, 20));
17 }
18
19 private static void unaryTest() {
20 UnaryOperator<String> hello = (name) -> "Hello, " + name;
21
22 System.out.println(hello.apply("Lambda"));
23 }
24 }
------
Hello, Lambda
30