forked from damaohongtu/JavaInterview
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLambdaTest.java
More file actions
19 lines (16 loc) · 477 Bytes
/
LambdaTest.java
File metadata and controls
19 lines (16 loc) · 477 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package Java8Test;/**
* @Classname LambdaTest
* @Description 测试lambda表达式
* @Date 19-7-5 上午10:37
* @Created by mao<tianmao818@qq.com>
*/
public class LambdaTest {
public static void main(String args[]) {
int num = 1;
Converter<Integer, String> s = (param) -> System.out.println(String.valueOf(param + num));
s.convert(2); // 输出结果为 3
}
public interface Converter<T1, T2> {
void convert(int i);
}
}