// the result indices are kind of nonsensical; we should make new pairs instead static Map> lcRenumberTopLevelEncodings_simplify(Map> encodings) { new MultiSet ms; for (L l : values(encodings)) ms.addAll(l); new LinkedHashMap> out; for (S file, L l : encodings) { new L l2; for i over l: { if (i > 0 && ms.get(l.get(i-1)) == 1 && ms.get(l.get(i)) == 1) continue; l2.add(l.get(i)); } out.put(file, l2); } ret out; }