// does not store null values static MultiMap multiMapIndexByField(Collection c, S field) { new MultiMap map; for (O a : c) { O val = getOpt(a, field); if (val != null) map.put(val, a); } ret map; } static MultiMap mapMethodLike multiMapIndexByField(S field, Collection c) { ret multiMapIndexByField(c, field); }