Originally posted by Ankit Garg:
Leonid why don't you try to understand. There are two subMap methods in TreeMap and two subSet in TreeSet class.
TreeMap subMap(Object start, boolean inclusive, Object end, boolean inclusive)
SortedMap subMap(Object start, Object end)
TreeSet subSet(Object start, boolean inclusive, Object end, boolean inclusive)
SortedSet subSet(Object start, Object end)
In your code just change these lines
SortedMap<String, String> submap;
submap = map.subMap("a", "h");
to
TreeMap<String, String> subMap;
subMap = map.subMap("a", true, "h", true);