Skip to content

Commit f0e93ad

Browse files
committed
StreamEx example
1 parent ee7fa85 commit f0e93ad

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

‎core-java-collections/pom.xml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@
6868
<artifactId>commons-exec</artifactId>
6969
<version>1.3</version>
7070
</dependency>
71+
<dependency>
72+
<groupId>one.util</groupId>
73+
<artifactId>streamex</artifactId>
74+
<version>0.6.5</version>
75+
</dependency>
7176

7277
</dependencies>
7378

‎core-java-collections/src/main/java/com/baeldung/map/java_8/MergeMaps.java‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
package com.baeldung.map.java_8;
22

33
import com.baeldung.sort.Employee;
4+
import one.util.streamex.EntryStream;
5+
import one.util.streamex.IntCollector;
6+
import one.util.streamex.StreamEx;
47

8+
import java.util.Collections;
59
import java.util.HashMap;
10+
import java.util.List;
611
import java.util.Map;
712
import java.util.stream.Collectors;
813
import java.util.stream.Stream;
@@ -20,7 +25,18 @@ public static void main(String[] args) {
2025

2126
//streamConcat();
2227

23-
streamOf();
28+
//streamOf();
29+
30+
streamEx();
31+
}
32+
33+
private static void streamEx() {
34+
Map<String, Employee> map3 = EntryStream.of(map1)
35+
.append(EntryStream.of(map2))
36+
.toMap((e1, e2) -> e1);
37+
38+
System.out.println(map3);
39+
2440
}
2541

2642
private static void streamOf() {

0 commit comments

Comments
 (0)