-
Notifications
You must be signed in to change notification settings - Fork 675
Closed
Labels
Description
<R> MapIterable<R, V> collectKeysUnique(Function2<? super K, ? super V, ? extends R> function);or
<R> MapIterable<R, V> collectKeysUnique(Function<? super K, ? extends R> function);Similar to the existing api:
<R> MapIterable<K, R> collectValues(Function2<? super K, ? super V, ? extends R> function);collectKeys is trickier than collectValues because after transformation, the new keys can be equal to each other and collapse into a smaller map. I'm inclined to say that collectKeys should throw, similar to the behavior of groupByUniqueKey, when the function returns non-unique results. On the other hand, RichIterable.toMap() and MutableMap.collectKeysAndValues() already silently collapse duplicates and no one seems to complain.
Reactions are currently unavailable