Java TreeMap subMap(K fromKey,K toKey) Method Example

The subMap(K fromKey, K toKey) method of java.util.TreeMap class returns a view of the portion of this map whose keys range from fromKey, inclusive, to toKey, exclusive. The returned map is backed by this map, so changes in the returned map are reflected in this map, and vice-versa. The returned map supports all optional map operations that this map supports.
[Read more…]