diff --git a/core/src/main/java/com/github/tonivade/purefun/data/ImmutableTreeMap.java b/core/src/main/java/com/github/tonivade/purefun/data/ImmutableTreeMap.java index 5934312b1..bf19e3af4 100644 --- a/core/src/main/java/com/github/tonivade/purefun/data/ImmutableTreeMap.java +++ b/core/src/main/java/com/github/tonivade/purefun/data/ImmutableTreeMap.java @@ -14,7 +14,6 @@ import java.util.Objects; import java.util.Set; import java.util.TreeMap; -import java.util.function.BinaryOperator; import java.util.stream.Collector; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -329,10 +328,10 @@ private Object readResolve() { private static Collector> toTreeMap( Function1 keyMapper, Function1 valueMapper) { - return Collectors.toMap(keyMapper::apply, valueMapper::apply, throwingMerge(), TreeMap::new); + return Collectors.toMap(keyMapper::apply, valueMapper::apply, ImmutableTreeMap::throwingMerge, TreeMap::new); } - private static BinaryOperator throwingMerge() { - return (a, b) -> { throw new IllegalArgumentException("conflict detected"); }; + private static V throwingMerge(V a, V b) { + throw new IllegalArgumentException("conflict detected"); } } \ No newline at end of file