-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLamdaTest.java
More file actions
95 lines (81 loc) · 2.87 KB
/
LamdaTest.java
File metadata and controls
95 lines (81 loc) · 2.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import lombok.Data;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.function.Predicate;
@Data
public class LamdaTest {
public static void main(String[] args){
// new HelloLamda().r1.run();
// new HelloLamda().r2.run();
// List languages = Arrays.asList("Java","C++","Python");
// Employee e1 = new Employee(1, 23, "M", "Rick", "Beethovan");
// Employee e2 = new Employee(2, 13, "F", "Martina", "Hengis");
// Employee e3 = new Employee(3, 43, "M", "Ricky", "Martin");
// Employee e4 = new Employee(4, 26, "M", "Jon", "Lowman");
// Employee e5 = new Employee(5, 19, "F", "Cristine", "Maria");
// Employee e6 = new Employee(6, 15, "M", "David", "Feezor");
// Employee e7 = new Employee(7, 68, "F", "Melissa", "Roy");
// Employee e8 = new Employee(8, 79, "M", "Alex", "Gussin");
// Employee e9 = new Employee(9, 15, "F", "Neetu", "Singh");
// Employee e10 = new Employee(10, 45, "M", "Naveen", "Jain");
//
// List<Employee> employees = new ArrayList<Employee>();
// employees.addAll(Arrays.asList(new Employee[] { e1, e2, e3, e4, e5, e6, e7, e8, e9, e10 }));
// employees.stream().filter(p -> p.getAge() > 21).forEach(System.out::println);
List<Character> chr = new ArrayList<>();
String s = "hello world!";
for( char a : s.toCharArray()) chr.add(a);
// chr.stream().filter(e -> e >'a' && e <'h').findFirst((e) -> System.out::println(e));
}
public static class Employee {
public Integer getId() {
return id;
}
public Integer getAge() {
return age;
}
public String getGender() {
return gender;
}
public String getFirstName() {
return firstName;
}
public String getLastName() {
return lastName;
}
private Integer id;
private Integer age;
private String gender;
private String firstName;
private String lastName;
public Employee(Integer id, Integer age, String gender, String fName, String lName) {
this.id = id;
this.age = age;
this.gender = gender;
this.firstName = fName;
this.lastName = lName;
}
@Override
public String toString() {
return this.id.toString() + " - " + this.age.toString()+"\n";
}
//get,set省略...
}
//
// public static class HelloLamda {
// Runnable r1 = () -> System.out.println(this);
// Runnable r2 = () -> System.out.println("test r2");
//
//
// @Override
// public String toString() {
// return "test r1";
// }
// }
//
// public static void filter(List listname, Predicate condition) {
//
// }
}