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.
这个函数是否创建新的 map 对象?返回对象中存储了什么?
最佳答案
Does this function create new map object?
是的,但是这个 Map
对象没有 map 中保存键和值的节点的新副本。如果您更改底层 map ,它可以更改此 map 。
关于java - TreeMap: NavigableMap<K,V> subMap(),它是否创建了新的 map 对象?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38486025/