@Beta protected class ForwardingNavigableSet.StandardDescendingSet extends ForwardingNavigableSet<E>
NavigableSet.descendingSet()
in terms of the other methods
of NavigableSet
, notably including NavigableSet.descendingIterator()
.
In many cases, you may wish to override ForwardingNavigableSet.descendingSet()
to
forward to this implementation or a subclass thereof.
ForwardingNavigableSet.StandardDescendingSet
Constructor and Description |
---|
ForwardingNavigableSet.StandardDescendingSet()
Constructor for use by subclasses.
|
Modifier and Type | Method and Description |
---|---|
E |
ceiling(E e)
Returns the least element in this set greater than or equal to
the given element, or
null if there is no such element. |
Comparator<? super E> |
comparator()
Returns the comparator used to order the elements in this set,
or null if this set uses the natural ordering of its elements.
|
protected NavigableSet<E> |
delegate()
Returns the backing delegate instance that methods are forwarded to.
|
Iterator<E> |
descendingIterator()
Returns an iterator over the elements in this set, in descending order.
|
NavigableSet<E> |
descendingSet()
Returns a reverse order view of the elements contained in this set.
|
E |
first()
Returns the first (lowest) element currently in this set.
|
E |
floor(E e)
Returns the greatest element in this set less than or equal to
the given element, or
null if there is no such element. |
SortedSet<E> |
headSet(E toElement)
Returns a view of the portion of this set whose elements are
strictly less than toElement.
|
NavigableSet<E> |
headSet(E toElement,
boolean inclusive)
Returns a view of the portion of this set whose elements are less than
(or equal to, if
inclusive is true) toElement . |
E |
higher(E e)
Returns the least element in this set strictly greater than the
given element, or
null if there is no such element. |
Iterator<E> |
iterator()
Returns an iterator over the elements in this collection.
|
E |
last()
Returns the last (highest) element currently in this set.
|
E |
lower(E e)
Returns the greatest element in this set strictly less than the
given element, or
null if there is no such element. |
E |
pollFirst()
Retrieves and removes the first (lowest) element,
or returns
null if this set is empty. |
E |
pollLast()
Retrieves and removes the last (highest) element,
or returns
null if this set is empty. |
NavigableSet<E> |
subSet(E fromElement,
boolean fromInclusive,
E toElement,
boolean toInclusive)
Returns a view of the portion of this set whose elements range from
fromElement to toElement . |
SortedSet<E> |
subSet(E fromElement,
E toElement)
Returns a view of the portion of this set whose elements range
from fromElement, inclusive, to toElement,
exclusive.
|
SortedSet<E> |
tailSet(E fromElement)
Returns a view of the portion of this set whose elements are
greater than or equal to fromElement.
|
NavigableSet<E> |
tailSet(E fromElement,
boolean inclusive)
Returns a view of the portion of this set whose elements are greater
than (or equal to, if
inclusive is true) fromElement . |
Object[] |
toArray()
Returns an array containing all of the elements in this collection.
|
<T> T[] |
toArray(T[] array)
Returns an array containing all of the elements in this collection;
the runtime type of the returned array is that of the specified array.
|
String |
toString()
Returns the string representation generated by the delegate's
toString method. |
standardCeiling, standardFirst, standardFloor, standardHeadSet, standardHigher, standardLast, standardLower, standardPollFirst, standardPollLast, standardSubSet, standardSubSet, standardTailSet
standardContains, standardRemove
equals, hashCode, standardEquals, standardHashCode, standardRemoveAll
add, addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, size, standardAddAll, standardClear, standardContainsAll, standardIsEmpty, standardRetainAll, standardToArray, standardToArray, standardToString
public ForwardingNavigableSet.StandardDescendingSet()
protected NavigableSet<E> delegate()
ForwardingObject
ForwardingSet.delegate()
. Concrete subclasses override this method to supply
the instance being decorated.delegate
in class ForwardingNavigableSet<E>
public E lower(E e)
java.util.NavigableSet
null
if there is no such element.lower
in interface NavigableSet<E>
lower
in class ForwardingNavigableSet<E>
e
- the value to matche
,
or null
if there is no such elementpublic E floor(E e)
java.util.NavigableSet
null
if there is no such element.floor
in interface NavigableSet<E>
floor
in class ForwardingNavigableSet<E>
e
- the value to matche
,
or null
if there is no such elementpublic E ceiling(E e)
java.util.NavigableSet
null
if there is no such element.ceiling
in interface NavigableSet<E>
ceiling
in class ForwardingNavigableSet<E>
e
- the value to matche
,
or null
if there is no such elementpublic E higher(E e)
java.util.NavigableSet
null
if there is no such element.higher
in interface NavigableSet<E>
higher
in class ForwardingNavigableSet<E>
e
- the value to matche
,
or null
if there is no such elementpublic E pollFirst()
java.util.NavigableSet
null
if this set is empty.pollFirst
in interface NavigableSet<E>
pollFirst
in class ForwardingNavigableSet<E>
null
if this set is emptypublic E pollLast()
java.util.NavigableSet
null
if this set is empty.pollLast
in interface NavigableSet<E>
pollLast
in class ForwardingNavigableSet<E>
null
if this set is emptypublic NavigableSet<E> descendingSet()
java.util.NavigableSet
remove
operation), the results of
the iteration are undefined.
The returned set has an ordering equivalent to
Collections.reverseOrder
(comparator()).
The expression s.descendingSet().descendingSet()
returns a
view of s
essentially equivalent to s
.
descendingSet
in interface NavigableSet<E>
descendingSet
in class ForwardingNavigableSet<E>
public Iterator<E> descendingIterator()
java.util.NavigableSet
descendingSet().iterator()
.descendingIterator
in interface NavigableSet<E>
descendingIterator
in class ForwardingNavigableSet<E>
public NavigableSet<E> subSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive)
java.util.NavigableSet
fromElement
to toElement
. If fromElement
and
toElement
are equal, the returned set is empty unless fromInclusive
and toInclusive
are both true. The returned set
is backed by this set, so changes in the returned set are reflected in
this set, and vice-versa. The returned set supports all optional set
operations that this set supports.
The returned set will throw an IllegalArgumentException
on an attempt to insert an element outside its range.
subSet
in interface NavigableSet<E>
subSet
in class ForwardingNavigableSet<E>
fromElement
- low endpoint of the returned setfromInclusive
- true
if the low endpoint
is to be included in the returned viewtoElement
- high endpoint of the returned settoInclusive
- true
if the high endpoint
is to be included in the returned viewfromElement
, inclusive, to toElement
, exclusivepublic NavigableSet<E> headSet(E toElement, boolean inclusive)
java.util.NavigableSet
inclusive
is true) toElement
. The
returned set is backed by this set, so changes in the returned set are
reflected in this set, and vice-versa. The returned set supports all
optional set operations that this set supports.
The returned set will throw an IllegalArgumentException
on an attempt to insert an element outside its range.
headSet
in interface NavigableSet<E>
headSet
in class ForwardingNavigableSet<E>
toElement
- high endpoint of the returned setinclusive
- true
if the high endpoint
is to be included in the returned viewinclusive
is true) toElement
public NavigableSet<E> tailSet(E fromElement, boolean inclusive)
java.util.NavigableSet
inclusive
is true) fromElement
.
The returned set is backed by this set, so changes in the returned set
are reflected in this set, and vice-versa. The returned set supports
all optional set operations that this set supports.
The returned set will throw an IllegalArgumentException
on an attempt to insert an element outside its range.
tailSet
in interface NavigableSet<E>
tailSet
in class ForwardingNavigableSet<E>
fromElement
- low endpoint of the returned setinclusive
- true
if the low endpoint
is to be included in the returned viewfromElement
public Comparator<? super E> comparator()
java.util.SortedSet
comparator
in interface SortedSet<E>
comparator
in class ForwardingSortedSet<E>
public E first()
java.util.SortedSet
first
in interface SortedSet<E>
first
in class ForwardingSortedSet<E>
public SortedSet<E> headSet(E toElement)
java.util.SortedSet
The returned set will throw an IllegalArgumentException on an attempt to insert an element outside its range.
headSet
in interface NavigableSet<E>
headSet
in interface SortedSet<E>
headSet
in class ForwardingSortedSet<E>
toElement
- high endpoint (exclusive) of the returned setpublic E last()
java.util.SortedSet
last
in interface SortedSet<E>
last
in class ForwardingSortedSet<E>
public SortedSet<E> subSet(E fromElement, E toElement)
java.util.SortedSet
The returned set will throw an IllegalArgumentException on an attempt to insert an element outside its range.
subSet
in interface NavigableSet<E>
subSet
in interface SortedSet<E>
subSet
in class ForwardingSortedSet<E>
fromElement
- low endpoint (inclusive) of the returned settoElement
- high endpoint (exclusive) of the returned setpublic SortedSet<E> tailSet(E fromElement)
java.util.SortedSet
The returned set will throw an IllegalArgumentException on an attempt to insert an element outside its range.
tailSet
in interface NavigableSet<E>
tailSet
in interface SortedSet<E>
tailSet
in class ForwardingSortedSet<E>
fromElement
- low endpoint (inclusive) of the returned setpublic Iterator<E> iterator()
java.util.Collection
iterator
in interface Iterable<E>
iterator
in interface Collection<E>
iterator
in interface NavigableSet<E>
iterator
in interface Set<E>
iterator
in class ForwardingCollection<E>
public Object[] toArray()
java.util.Collection
The returned array will be "safe" in that no references to it are maintained by this collection. (In other words, this method must allocate a new array even if this collection is backed by an array). The caller is thus free to modify the returned array.
This method acts as bridge between array-based and collection-based APIs.
toArray
in interface Collection<E>
toArray
in interface Set<E>
toArray
in class ForwardingCollection<E>
public <T> T[] toArray(T[] array)
java.util.Collection
If this collection fits in the specified array with room to spare (i.e., the array has more elements than this collection), the element in the array immediately following the end of the collection is set to null. (This is useful in determining the length of this collection only if the caller knows that this collection does not contain any null elements.)
If this collection makes any guarantees as to what order its elements are returned by its iterator, this method must return the elements in the same order.
Like the Collection.toArray()
method, this method acts as bridge between
array-based and collection-based APIs. Further, this method allows
precise control over the runtime type of the output array, and may,
under certain circumstances, be used to save allocation costs.
Suppose x is a collection known to contain only strings. The following code can be used to dump the collection into a newly allocated array of String:
String[] y = x.toArray(new String[0]);Note that toArray(new Object[0]) is identical in function to toArray().
toArray
in interface Collection<E>
toArray
in interface Set<E>
toArray
in class ForwardingCollection<E>
array
- the array into which the elements of this collection are to be
stored, if it is big enough; otherwise, a new array of the same
runtime type is allocated for this purpose.public String toString()
ForwardingObject
toString
method.toString
in class ForwardingObject
Copyright © 2010-2013. All Rights Reserved.