A {@code NavigableMap} may be accessed and traversed in eitherascending or descending key order. The {@code descendingMap}method returns a view of the map with the senses of all relational and directional methods inverted. The performance of ascending operations and views is likely to be faster than that of descending ones. Methods {@code subMap}, {@code headMap}, and {@code tailMap} differ from the like-named {@code SortedMap} methods in accepting additional arguments describingwhether lower and upper bounds are inclusive versus exclusive. Submaps of any {@code NavigableMap} must implement the {@code NavigableMap} interface.
This interface additionally defines methods {@code firstEntry}, {@code pollFirstEntry}, {@code lastEntry}, and {@code pollLastEntry} that return and/or remove the least andgreatest mappings, if any exist, else returning {@code null}.
Implementations of entry-returning methods are expected to return {@code Map.Entry} pairs representing snapshots of mappingsat the time they were produced, and thus generally do not support the optional {@code Entry.setValue} method. Note howeverthat it is possible to change mappings in the associated map using method {@code put}.
Methods {@link #subMap(Object,Object) subMap(K, K)}, {@link #headMap(Object) headMap(K)}, and {@link #tailMap(Object) tailMap(K)}are specified to return {@code SortedMap} to allow existingimplementations of {@code SortedMap} to be compatibly retrofitted toimplement {@code NavigableMap}, but extensions and implementations of this interface are encouraged to override these methods to return {@code NavigableMap}. Similarly, {@link #keySet()} can be overriden to return {@code NavigableSet}.
This interface is a member of the Java Collections Framework. @author Doug Lea @author Josh Bloch @param < K> the type of keys maintained by this map @param < V> the type of mapped values @since 1.6
|
|
|
|
|
|
|
|
|
|