A {@link SortedSet} extended with navigation methods reportingclosest matches for given search targets. Methods {@code lower}, {@code floor}, {@code ceiling}, and {@code higher} return elementsrespectively less than, less than or equal, greater than or equal, and greater than a given element, returning {@code null} if thereis no such element. A {@code NavigableSet} may be accessed andtraversed in either ascending or descending order. The {@code descendingSet} method returns a view of the set with the senses ofall relational and directional methods inverted. The performance of ascending operations and views is likely to be faster than that of descending ones. This interface additionally defines methods {@code pollFirst} and {@code pollLast} that return and remove thelowest and highest element, if one exists, else returning {@code null}. Methods {@code subSet}, {@code headSet}, and {@code tailSet} differ from the like-named {@code SortedSet} methods in accepting additional arguments describingwhether lower and upper bounds are inclusive versus exclusive. Subsets of any {@code NavigableSet} must implement the {@code NavigableSet} interface.
The return values of navigation methods may be ambiguous in implementations that permit {@code null} elements. However, evenin this case the result can be disambiguated by checking {@code contains(null)}. To avoid such issues, implementations of this interface are encouraged to not permit insertion of {@code null} elements. (Note that sorted sets of {@link Comparable} elements intrinsically do not permit {@code null}.)
Methods {@link #subSet(Object,Object) subSet(E, E)}, {@link #headSet(Object) headSet(E)}, and {@link #tailSet(Object) tailSet(E)}are specified to return {@code SortedSet} to allow existingimplementations of {@code SortedSet} to be compatibly retrofitted toimplement {@code NavigableSet}, but extensions and implementations of this interface are encouraged to override these methods to return {@code NavigableSet}.
This interface is a member of the Java Collections Framework.
@author Doug Lea
@author Josh Bloch
@param < E> the type of elements maintained by this set
@since 1.6