@NotNull private static MultiMap<Hash, VcsRef> prepareRefsMap(@NotNull Collection<VcsRef> refs) { MultiMap<Hash, VcsRef> map = MultiMap.createSmartList(); for (VcsRef ref : refs) { map.putValue(ref.getCommitHash(), ref); } return map; }
@NotNull private TIntObjectHashMap<SmartList<VcsRef>> prepareRefsToIndicesMap( @NotNull Collection<VcsRef> refs) { TIntObjectHashMap<SmartList<VcsRef>> map = new TIntObjectHashMap<SmartList<VcsRef>>(); for (VcsRef ref : refs) { int index = myIndexGetter.fun(ref.getCommitHash()); SmartList<VcsRef> list = map.get(index); if (list == null) map.put(index, list = new SmartList<VcsRef>()); list.add(ref); } return map; }