Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
tonivade committed Mar 10, 2024
1 parent c9e6092 commit 4c57de2
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -329,10 +328,10 @@ private Object readResolve() {
private static <T, K, V> Collector<T, ?, ? extends TreeMap<K, V>> toTreeMap(
Function1<? super T, ? extends K> keyMapper,
Function1<? super T, ? extends V> valueMapper) {
return Collectors.toMap(keyMapper::apply, valueMapper::apply, throwingMerge(), TreeMap::new);
return Collectors.toMap(keyMapper::apply, valueMapper::apply, ImmutableTreeMap::throwingMerge, TreeMap::new);
}

private static <V> BinaryOperator<V> throwingMerge() {
return (a, b) -> { throw new IllegalArgumentException("conflict detected"); };
private static <V> V throwingMerge(V a, V b) {
throw new IllegalArgumentException("conflict detected");
}
}

0 comments on commit 4c57de2

Please sign in to comment.