Before using google collections I had something similar to next code:
private Set<A> aSet = ...;
private Set<B> bSet = ...;
public Foo getFoo (Map<?, List<Bar>> bars, Set<?> set) {
for (Object item : set) {
for (Bar bar : bars.get (item)) {
//build foo;
}
}
...
}
and I was able to make calls like these:
Map<A, List<Bar> aMap = getAMap ();
Foo f1 = getFoo (aMap, aSet);
Map<B, List<Bar> bMap = getBMap ();
Foo f2 = getFoo (bMap, bSet);
Now, with Multimap, I cannot do the same:
public Foo getFoo (Multimap<?, List<Bar>> bars, Set<?> set) {
for (Object item : set) {
// compile error: get(capture#621 of ?) in Multimap ... cannot be applied to java.lang.Object
for (Bar bar : bars.get (item)) {
//build foo;
}
}
...
}