Returns a new TreeMap containing entries whose keys are in the range [from, to) (from inclusive, to exclusive).
Example:
var map = new TreeMap<string,string> ((a, b) => {
return strcmp (a, b);
});
map.put ("a", "1");
map.put ("b", "2");
map.put ("c", "3");
map.put ("d", "4");
var sub = map.subMap ("b", "d");
assert (sub.size () == 2);
assert (sub.containsKey ("b"));
assert (sub.containsKey ("c"));
| from |
the lower bound (inclusive). |
| to |
the upper bound (exclusive). |
|
a new TreeMap with the sub-range. |