static TreeMap pairsToTreeMap(Collection extends Pair> l) { new TreeMap map; if (l != null) for (Pair p : l) map.put(p.a, p.b); ret map; }