|
2 | 2 |
|
3 | 3 | import com.baeldung.sort.Employee; |
4 | 4 | import one.util.streamex.EntryStream; |
5 | | -import one.util.streamex.IntCollector; |
6 | | -import one.util.streamex.StreamEx; |
7 | | - |
8 | | -import java.util.Collections; |
9 | 5 | import java.util.HashMap; |
10 | | -import java.util.List; |
11 | 6 | import java.util.Map; |
12 | 7 | import java.util.stream.Collectors; |
13 | 8 | import java.util.stream.Stream; |
@@ -75,7 +70,7 @@ private static void streamConcat() { |
75 | 70 | Map<String, Employee> result = Stream.concat(map1.entrySet().stream(), map2.entrySet().stream()).collect(Collectors.toMap( |
76 | 71 | Map.Entry::getKey, |
77 | 72 | Map.Entry::getValue, |
78 | | - (value1, value2) -> new Employee(value1.getId(), value2.getName()) |
| 73 | + (value1, value2) -> new Employee(value2.getId(), value1.getName()) |
79 | 74 | )); |
80 | 75 |
|
81 | 76 | result.entrySet().forEach(System.out::println); |
@@ -103,7 +98,7 @@ private static void initialize() { |
103 | 98 |
|
104 | 99 | Employee employee4 = new Employee(2L, "George"); |
105 | 100 | map2.put(employee4.getName(), employee4); |
106 | | - Employee employee5 = new Employee(1L, "Henry"); |
| 101 | + Employee employee5 = new Employee(3L, "Henry"); |
107 | 102 | map2.put(employee5.getName(), employee5); |
108 | 103 | } |
109 | 104 |
|
|
0 commit comments