Open
Description
openedon Jun 29, 2020
Essentially syntactic sugar to provide parity to the other immutable map collectors when possible.
I believe this can be added relatively simply in https://github.com/google/guava/blob/master/guava/src/com/google/common/collect/ImmutableSortedMap.java:
public static <T, K extends Comparable<K>, V> Collector<T, ?, ImmutableSortedMap<K, V>> toImmutableSortedMap(
Function<? super T, ? extends K> keyFunction,
Function<? super T, ? extends V> valueFunction) {
return toImmutableSortedMap(Comparable::compareTo, keyFunction, valueFunction);
}
And:
public static <T, K extends Comparable<K>, V> Collector<T, ?, ImmutableSortedMap<K, V>> toImmutableSortedMap(
Function<? super T, ? extends K> keyFunction,
Function<? super T, ? extends V> valueFunction,
BinaryOperator<V> mergeFunction) {
return toImmutableSortedMap(Comparable::compareTo, keyFunction, valueFunction, mergeFunction);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment