0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * This file is available under and governed by the GNU General Public 0N/A * License version 2 only, as published by the Free Software Foundation. 0N/A * However, the following notice accompanied the original version of this 0N/A * Written by Doug Lea and Josh Bloch with assistance from members of JCP 0N/A * JSR-166 Expert Group and released to the public domain, as explained at 0N/A * A {@link SortedSet} extended with navigation methods reporting 0N/A * closest matches for given search targets. Methods {@code lower}, 0N/A * {@code floor}, {@code ceiling}, and {@code higher} return elements 0N/A * respectively less than, less than or equal, greater than or equal, 0N/A * and greater than a given element, returning {@code null} if there 0N/A * is no such element. A {@code NavigableSet} may be accessed and 0N/A * traversed in either ascending or descending order. The {@code 0N/A * descendingSet} method returns a view of the set with the senses of 0N/A * all relational and directional methods inverted. The performance of 0N/A * ascending operations and views is likely to be faster than that of 0N/A * descending ones. This interface additionally defines methods 0N/A * {@code pollFirst} and {@code pollLast} that return and remove the 0N/A * lowest and highest element, if one exists, else returning {@code 0N/A * null}. Methods {@code subSet}, {@code headSet}, 0N/A * and {@code tailSet} differ from the like-named {@code 0N/A * SortedSet} methods in accepting additional arguments describing 0N/A * whether lower and upper bounds are inclusive versus exclusive. 0N/A * Subsets of any {@code NavigableSet} must implement the {@code 0N/A * NavigableSet} interface. 0N/A * <p> The return values of navigation methods may be ambiguous in 0N/A * implementations that permit {@code null} elements. However, even 0N/A * in this case the result can be disambiguated by checking 0N/A * {@code contains(null)}. To avoid such issues, implementations of 0N/A * this interface are encouraged to <em>not</em> permit insertion of 0N/A * {@code null} elements. (Note that sorted sets of {@link 0N/A * Comparable} elements intrinsically do not permit {@code null}.) 0N/A * {@link #subSet(Object, Object) subSet(E, E)}, 0N/A * {@link #headSet(Object) headSet(E)}, and 0N/A * {@link #tailSet(Object) tailSet(E)} 0N/A * are specified to return {@code SortedSet} to allow existing 0N/A * implementations of {@code SortedSet} to be compatibly retrofitted to 0N/A * implement {@code NavigableSet}, but extensions and implementations 0N/A * of this interface are encouraged to override these methods to return 0N/A * {@code NavigableSet}. 0N/A * <p>This interface is a member of the 0N/A * Java Collections Framework</a>. 0N/A * @author Josh Bloch 0N/A * @param <E> the type of elements maintained by this set 0N/A * Returns the greatest element in this set strictly less than the 0N/A * given element, or {@code null} if there is no such element. 0N/A * @param e the value to match 0N/A * @return the greatest element less than {@code e}, 0N/A * or {@code null} if there is no such element 0N/A * @throws ClassCastException if the specified element cannot be 0N/A * compared with the elements currently in the set 0N/A * @throws NullPointerException if the specified element is null 0N/A * and this set does not permit null elements 0N/A * Returns the greatest element in this set less than or equal to 0N/A * the given element, or {@code null} if there is no such element. 0N/A * @param e the value to match 0N/A * @return the greatest element less than or equal to {@code e}, 0N/A * or {@code null} if there is no such element 0N/A * @throws ClassCastException if the specified element cannot be 0N/A * compared with the elements currently in the set 0N/A * @throws NullPointerException if the specified element is null 0N/A * and this set does not permit null elements 0N/A * Returns the least element in this set greater than or equal to 0N/A * the given element, or {@code null} if there is no such element. 0N/A * @param e the value to match 0N/A * @return the least element greater than or equal to {@code e}, 0N/A * or {@code null} if there is no such element 0N/A * @throws ClassCastException if the specified element cannot be 0N/A * compared with the elements currently in the set 0N/A * @throws NullPointerException if the specified element is null 0N/A * and this set does not permit null elements 0N/A * Returns the least element in this set strictly greater than the 0N/A * given element, or {@code null} if there is no such element. 0N/A * @param e the value to match 0N/A * @return the least element greater than {@code e}, 0N/A * or {@code null} if there is no such element 0N/A * @throws ClassCastException if the specified element cannot be 0N/A * compared with the elements currently in the set 0N/A * @throws NullPointerException if the specified element is null 0N/A * and this set does not permit null elements 0N/A * Retrieves and removes the first (lowest) element, 0N/A * or returns {@code null} if this set is empty. 0N/A * @return the first element, or {@code null} if this set is empty 0N/A * Retrieves and removes the last (highest) element, 0N/A * or returns {@code null} if this set is empty. 0N/A * @return the last element, or {@code null} if this set is empty 0N/A * Returns an iterator over the elements in this set, in ascending order. 0N/A * @return an iterator over the elements in this set, in ascending order 0N/A * Returns a reverse order view of the elements contained in this set. 0N/A * The descending set is backed by this set, so changes to the set are 0N/A * reflected in the descending set, and vice-versa. If either set is 0N/A * modified while an iteration over either set is in progress (except 0N/A * through the iterator's own {@code remove} operation), the results of 0N/A * the iteration are undefined. 0N/A * <p>The returned set has an ordering equivalent to 0N/A * <tt>{@link Collections#reverseOrder(Comparator) Collections.reverseOrder}(comparator())</tt>. 0N/A * The expression {@code s.descendingSet().descendingSet()} returns a 0N/A * view of {@code s} essentially equivalent to {@code s}. 0N/A * @return a reverse order view of this set 0N/A * Returns an iterator over the elements in this set, in descending order. 0N/A * Equivalent in effect to {@code descendingSet().iterator()}. 0N/A * @return an iterator over the elements in this set, in descending order 0N/A * Returns a view of the portion of this set whose elements range from 0N/A * {@code fromElement} to {@code toElement}. If {@code fromElement} and 0N/A * {@code toElement} are equal, the returned set is empty unless {@code 2085N/A * fromInclusive} and {@code toInclusive} are both true. The returned set 0N/A * is backed by this set, so changes in the returned set are reflected in 0N/A * this set, and vice-versa. The returned set supports all optional set 0N/A * operations that this set supports. 0N/A * <p>The returned set will throw an {@code IllegalArgumentException} 0N/A * on an attempt to insert an element outside its range. 0N/A * @param fromElement low endpoint of the returned set 0N/A * @param fromInclusive {@code true} if the low endpoint 0N/A * is to be included in the returned view 0N/A * @param toElement high endpoint of the returned set 0N/A * @param toInclusive {@code true} if the high endpoint 0N/A * is to be included in the returned view 0N/A * @return a view of the portion of this set whose elements range from 0N/A * {@code fromElement}, inclusive, to {@code toElement}, exclusive 0N/A * @throws ClassCastException if {@code fromElement} and 0N/A * {@code toElement} cannot be compared to one another using this 0N/A * set's comparator (or, if the set has no comparator, using 0N/A * natural ordering). Implementations may, but are not required 0N/A * to, throw this exception if {@code fromElement} or 0N/A * {@code toElement} cannot be compared to elements currently in 0N/A * @throws NullPointerException if {@code fromElement} or 0N/A * {@code toElement} is null and this set does 0N/A * not permit null elements 0N/A * @throws IllegalArgumentException if {@code fromElement} is 0N/A * greater than {@code toElement}; or if this set itself 0N/A * has a restricted range, and {@code fromElement} or 0N/A * {@code toElement} lies outside the bounds of the range. 0N/A * Returns a view of the portion of this set whose elements are less than 0N/A * (or equal to, if {@code inclusive} is true) {@code toElement}. The 0N/A * returned set is backed by this set, so changes in the returned set are 0N/A * reflected in this set, and vice-versa. The returned set supports all 0N/A * optional set operations that this set supports. 0N/A * <p>The returned set will throw an {@code IllegalArgumentException} 0N/A * on an attempt to insert an element outside its range. 0N/A * @param toElement high endpoint of the returned set 0N/A * @param inclusive {@code true} if the high endpoint 0N/A * is to be included in the returned view 0N/A * @return a view of the portion of this set whose elements are less than 0N/A * (or equal to, if {@code inclusive} is true) {@code toElement} 0N/A * @throws ClassCastException if {@code toElement} is not compatible 0N/A * with this set's comparator (or, if the set has no comparator, 0N/A * if {@code toElement} does not implement {@link Comparable}). 0N/A * Implementations may, but are not required to, throw this 0N/A * exception if {@code toElement} cannot be compared to elements 0N/A * currently in the set. 0N/A * @throws NullPointerException if {@code toElement} is null and 0N/A * this set does not permit null elements 0N/A * @throws IllegalArgumentException if this set itself has a 0N/A * restricted range, and {@code toElement} lies outside the 0N/A * bounds of the range 0N/A * Returns a view of the portion of this set whose elements are greater 0N/A * than (or equal to, if {@code inclusive} is true) {@code fromElement}. 0N/A * The returned set is backed by this set, so changes in the returned set 0N/A * are reflected in this set, and vice-versa. The returned set supports 0N/A * all optional set operations that this set supports. 0N/A * <p>The returned set will throw an {@code IllegalArgumentException} 0N/A * on an attempt to insert an element outside its range. 0N/A * @param fromElement low endpoint of the returned set 0N/A * @param inclusive {@code true} if the low endpoint 0N/A * is to be included in the returned view 0N/A * @return a view of the portion of this set whose elements are greater 0N/A * than or equal to {@code fromElement} 0N/A * @throws ClassCastException if {@code fromElement} is not compatible 0N/A * with this set's comparator (or, if the set has no comparator, 0N/A * if {@code fromElement} does not implement {@link Comparable}). 0N/A * Implementations may, but are not required to, throw this 0N/A * exception if {@code fromElement} cannot be compared to elements 0N/A * currently in the set. 0N/A * @throws NullPointerException if {@code fromElement} is null 0N/A * and this set does not permit null elements 0N/A * @throws IllegalArgumentException if this set itself has a 0N/A * restricted range, and {@code fromElement} lies outside the 0N/A * bounds of the range 0N/A * <p>Equivalent to {@code subSet(fromElement, true, toElement, false)}. 0N/A * @throws ClassCastException {@inheritDoc} 0N/A * @throws NullPointerException {@inheritDoc} 0N/A * @throws IllegalArgumentException {@inheritDoc} 0N/A * <p>Equivalent to {@code headSet(toElement, false)}. 0N/A * @throws ClassCastException {@inheritDoc} 0N/A * @throws NullPointerException {@inheritDoc} 0N/A * @throws IllegalArgumentException {@inheritDoc} 0N/A * <p>Equivalent to {@code tailSet(fromElement, true)}. 0N/A * @throws ClassCastException {@inheritDoc} 0N/A * @throws NullPointerException {@inheritDoc} 0N/A * @throws IllegalArgumentException {@inheritDoc}