A {@link SortedMap} extended with navigation methods returning the closest matches for givensearch targets. Methods {@code lowerEntry}, {@code floorEntry}, {@code ceilingEntry}, and {@code higherEntry} return {@code Map.Entry} objects associated with keys respectively less than, lessthan or equal, greater than or equal, and greater than a given key, returning {@code null} ifthere is no such key. Similarly, methods {@code lowerKey}, {@code floorKey}, {@code ceilingKey}, and {@code higherKey} return only the associated keys. All of these methods are designed forlocating, not traversing entries.
A {@code NavigableMap} may be accessed and traversed in either ascending or descending key order.The {@code descendingMap} method returns a view of the map with the senses of all relational anddirectional 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 and greatest mappings,if any exist, else returning {@code null}.
Implementations of entry-returning methods are expected to return {@code Map.Entry} pairsrepresenting snapshots of mappings at the time they were produced, and thus generally do not support the optional {@code Entry.setValue} method. Note however that it is possibleto 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 to implement {@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 toreturn {@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