You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Stream equivalent:stream.collect(Collectors.groupingBy(keyFunction)) behaves similarly, but returns a mutable Map<K, List<E>> instead, and may not preserve the order of entries).
Since 21.0, stream.collect(ImmutableListMultimap.toImmutableListMultimap(keyFunction, v -> v)) may be used.
The text was updated successfully, but these errors were encountered:
It seems to me that it was rather about updating javadoc. The note about stream equivalent appeared in 19.0. Since 21.0, instead of stream.collect(Collectors.groupingBy(keyFunction)) you can use stream.collect(ImmutableListMultimap.toImmutableListMultimap(keyFunction, v -> v)), which is even "more equivalent", as it preserves the order of entries and gives you ImmutableListMultimap<K, E>, not mutable Map<K, List<E>>.
Shortcut that doesn't require v -> v would be handy, but I don't insist.
http://google.github.io/guava/releases/24.1-jre/api/docs/com/google/common/collect/FluentIterable.html#index-com.google.common.base.Function-
Since 21.0,
stream.collect(ImmutableListMultimap.toImmutableListMultimap(keyFunction, v -> v))
may be used.The text was updated successfully, but these errors were encountered: