static Map keysStartingWith(String x, TreeMap map) { if (empty(x)) ret map; S lastKey = lexicographicallyNextString(x); ret map.subMap(x, true, lastKey, false); } static Map keysStartingWith(TreeMap map, String x) { ret keysStartingWith(x, map); }