--- jsr166/src/main/java/util/NavigableSet.java 2004/12/28 12:14:07 1.1 +++ jsr166/src/main/java/util/NavigableSet.java 2005/05/02 08:35:49 1.5 @@ -21,6 +21,10 @@ package java.util; * additionally defines methods pollFirst and * pollLast that return and remove the lowest and highest key, * if one exists, else returning null. + * Methods navigableSubSet, navigableHeadSet, and + * navigableTailSet differ from the similarly named + * SortedSet methods only in that the returned sets + * are guaranteed to obey the NavigableSet interface. * *

The return values of navigation methods may be ambiguous in * implementations that permit null elements. However, even @@ -38,71 +42,71 @@ public interface NavigableSet extends * Returns an element greater than or equal to the given element, or * null if there is no such element. * - * @param o the value to match + * @param e the value to match * @return an element greater than or equal to given element, or * null if there is no such element. - * @throws ClassCastException if o cannot be compared with the elements + * @throws ClassCastException if e cannot be compared with the elements * currently in the set. - * @throws NullPointerException if o is null - * and this set deas not permit null elements + * @throws NullPointerException if e is null + * and this set does not permit null elements */ - public E ceiling(E o); + E ceiling(E e); /** * Returns an element strictly less than the given element, or * null if there is no such element. * - * @param o the value to match + * @param e the value to match * @return the greatest element less than the given element, or * null if there is no such element. - * @throws ClassCastException if o cannot be compared with the elements + * @throws ClassCastException if e cannot be compared with the elements * currently in the set. - * @throws NullPointerException if o is null - * and this set deas not permit null elements + * @throws NullPointerException if e is null + * and this set does not permit null elements */ - public E lower(E o); + E lower(E e); /** * Returns an element less than or equal to the given element, or * null if there is no such element. * - * @param o the value to match + * @param e the value to match * @return the greatest element less than or equal to given * element, or null if there is no such element. - * @throws ClassCastException if o cannot be compared with the elements + * @throws ClassCastException if e cannot be compared with the elements * currently in the set. - * @throws NullPointerException if o is null. - * and this set deas not permit null elements + * @throws NullPointerException if e is null. + * and this set does not permit null elements */ - public E floor(E o); + E floor(E e); /** * Returns an element strictly greater than the given element, or * null if there is no such element. * - * @param o the value to match + * @param e the value to match * @return the least element greater than the given element, or * null if there is no such element. - * @throws ClassCastException if o cannot be compared with the elements + * @throws ClassCastException if e cannot be compared with the elements * currently in the set. - * @throws NullPointerException if o is null - * and this set deas not permit null elements + * @throws NullPointerException if e is null + * and this set does not permit null elements */ - public E higher(E o); + E higher(E e); /** * Retrieves and removes the first (lowest) element. * * @return the first element, or null if empty. */ - public E pollFirst(); + E pollFirst(); /** * Retrieves and removes the last (highest) element. * * @return the last element, or null if empty. */ - public E pollLast(); + E pollLast(); /** * Returns an iterator over the elements in this collection, in @@ -113,12 +117,13 @@ public interface NavigableSet extends Iterator descendingIterator(); /** - * Returns a view of the portion of this set whose elements range from - * fromElement, inclusive, to toElement, exclusive. (If - * fromElement and toElement are equal, the returned - * sorted set is empty.) The returned sorted set is backed by this set, - * so changes in the returned sorted set are reflected in this set, and - * vice-versa. + * Returns a view of the portion of this set whose elements range + * from fromElement, inclusive, to toElement, + * exclusive. (If fromElement and toElement are + * equal, the returned navigable set is empty.) The returned + * navigable set is backed by this set, so changes in the returned + * navigable set are reflected in this set, and vice-versa. + * * @param fromElement low endpoint (inclusive) of the subSet. * @param toElement high endpoint (exclusive) of the subSet. * @return a view of the portion of this set whose elements range from @@ -132,15 +137,15 @@ public interface NavigableSet extends * greater than toElement. * @throws NullPointerException if fromElement or * toElement is null - * and this set deas not permit null elements + * and this set does not permit null elements */ - public NavigableSet subSet(E fromElement, E toElement); + NavigableSet navigableSubSet(E fromElement, E toElement); /** - * Returns a view of the portion of this set whose elements are strictly - * less than toElement. The returned sorted set is backed by - * this set, so changes in the returned sorted set are reflected in this - * set, and vice-versa. + * Returns a view of the portion of this set whose elements are + * strictly less than toElement. The returned navigable + * set is backed by this set, so changes in the returned navigable + * set are reflected in this set, and vice-versa. * @param toElement high endpoint (exclusive) of the headSet. * @return a view of the portion of this set whose elements are strictly * less than toElement. @@ -148,15 +153,15 @@ public interface NavigableSet extends * with this set's comparator (or, if the set has no comparator, * if toElement does not implement Comparable). * @throws NullPointerException if toElement is null - * and this set deas not permit null elements + * and this set does not permit null elements */ - public NavigableSet headSet(E toElement); + NavigableSet navigableHeadSet(E toElement); /** * Returns a view of the portion of this set whose elements are * greater than or equal to fromElement. The returned - * sorted set is backed by this set, so changes in the returned - * sorted set are reflected in this set, and vice-versa. + * navigable set is backed by this set, so changes in the returned + * navigable set are reflected in this set, and vice-versa. * @param fromElement low endpoint (inclusive) of the tailSet. * @return a view of the portion of this set whose elements are * greater than or equal to fromElement. @@ -165,7 +170,7 @@ public interface NavigableSet extends * comparator, if fromElement does not implement * Comparable). * @throws NullPointerException if fromElement is null - * and this set deas not permit null elements + * and this set does not permit null elements */ - public NavigableSet tailSet(E fromElement); + NavigableSet navigableTailSet(E fromElement); }