aboutsummaryrefslogtreecommitdiff
path: root/src/ch/epfl/xblast/Lists.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/ch/epfl/xblast/Lists.java')
-rw-r--r--src/ch/epfl/xblast/Lists.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/ch/epfl/xblast/Lists.java b/src/ch/epfl/xblast/Lists.java
index 7e3ba5e..9bd527b 100644
--- a/src/ch/epfl/xblast/Lists.java
+++ b/src/ch/epfl/xblast/Lists.java
@@ -250,6 +250,8 @@ public final class Lists {
250 */ 250 */
251 public static <K, IK, V> Map<K, V> traverseMaps(Map<K, IK> m1, Map<IK, V> m2) { 251 public static <K, IK, V> Map<K, V> traverseMaps(Map<K, IK> m1, Map<IK, V> m2) {
252 return Collections.unmodifiableMap(m1.entrySet().stream() 252 return Collections.unmodifiableMap(m1.entrySet().stream()
253 .filter(e -> Objects.nonNull(e.getValue()))
254 .filter(e -> Objects.nonNull(m2.get(e.getValue())))
253 .collect(Collectors.toMap(Map.Entry::getKey, e -> m2.get(e.getValue())))); 255 .collect(Collectors.toMap(Map.Entry::getKey, e -> m2.get(e.getValue()))));
254 } 256 }
255 257
@@ -263,6 +265,8 @@ public final class Lists {
263 */ 265 */
264 public static <K, V> Map<K, V> invertMap(Map<V, K> m) { 266 public static <K, V> Map<K, V> invertMap(Map<V, K> m) {
265 return Collections.unmodifiableMap(m.entrySet().stream() 267 return Collections.unmodifiableMap(m.entrySet().stream()
268 .filter(e -> Objects.nonNull(e.getKey()))
269 .filter(e -> Objects.nonNull(e.getValue()))
266 .collect(Collectors.toMap(Map.Entry::getValue, Map.Entry::getKey))); 270 .collect(Collectors.toMap(Map.Entry::getValue, Map.Entry::getKey)));
267 } 271 }
268 272