-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathChallenge_39.java
39 lines (31 loc) · 907 Bytes
/
Challenge_39.java
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
package challenge31_40;
import java.util.List;
/**
*
*/
public class Challenge_39 {
public static void main( String[] args ) {
List<Jedi> jediList = List.of(new Jedi("Luke", 20),
new Jedi("Obiman", 30), new Jedi("QinGon", 40));
jediList.stream()
.filter(jedi -> jedi.name.startsWith("Obi") || jedi.name.startsWith("Luke"))
.filter(jedi -> jedi.name.startsWith("QinGon"))
.map(Jedi::getAge)
.filter(age->age>10)
.forEach(System.out::println);
}
static class Jedi {
private String name;
private int age;
public Jedi( String name, int age ) {
this.name = name;
this.age = age;
}
public int getAge() {
return age;
}
public String getName() {
return name;
}
}
}