public NavigableMap<K,V> subMap(K fromKey,
boolean fromInclusive,
K toKey,
boolean toInclusive)
Description copied from interface: NavigableMap Returns a view of the portion of this map whose keys range from fromKey to toKey. If fromKey and toKey are equal, the returned map is empty unless fromInclusive and toInclusive are both true. 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.
Does this function create new map object? What is stored in the return object?
Does this function create new map object?
Yes, however this Map
object doesn't have a new copy of the nodes in the map which hold the keys and values. If you change the underlying map, it can alter this Map.