Zip two lists into an immutable multimap in Java 8 with Guava?

The for loop looks like

ImmutableListMultiMap.Builder builder

= ImmutableListMultiMap.newBuilder();

for (int i = 0; i < Math.min(keys.length(), values.length(); i++) {



A possible first step in Guava / Java 8 is, values, zippingFunction)

I think zippingFunction needs to return a map entry, but there isn't a publicly constructable list entry. So the "most" functional way I can write this is with a zipping function that returns a Pair, which I'm not sure exists in Guava, or returns a two-element list, which is a mutable type that does not properly connote there are...

Read More »

By: StackOverFlow - Tuesday, 13 March

Related Posts