-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMethodRef5.java
More file actions
27 lines (22 loc) · 780 Bytes
/
Copy pathMethodRef5.java
File metadata and controls
27 lines (22 loc) · 780 Bytes
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
package methodref;
import lambda.lambda5.mystream.MyStreamV3;
import java.util.List;
public class MethodRef5 {
public static void main(String[] args) {
List<Person> personList = List.of(
new Person("Kim"),
new Person("Park"),
new Person("Lee")
);
List<String> result1 = MyStreamV3.of(personList)
.map(person -> person.introduce())
.map(str -> str.toUpperCase())
.toList();
System.out.println("result1 = " + result1);
List<String> result2 = MyStreamV3.of(personList)
.map(Person::introduce)
.map(String::toUpperCase)
.toList();
System.out.println("result2 = " + result2);
}
}