public class DescendingRandomAccessSet<E> extends DescendingSet<E> implements RandomAccessNavigableSet<E>
Constructor and Description |
---|
DescendingRandomAccessSet(RandomAccessNavigableSet<E> base) |
Modifier and Type | Method and Description |
---|---|
List<E> |
asList()
Returns a view of this set as a list.
|
protected RandomAccessNavigableSet<E> |
base() |
RandomAccessNavigableSet<E> |
descendingSet() |
E |
get(int index)
Retrieves the item at the specified index.
|
RandomAccessNavigableSet<E> |
headSet(E toElement) |
RandomAccessNavigableSet<E> |
headSet(E toElement,
boolean inclusive) |
int |
indexOf(Object o)
Retrieves the index of the specified element in the set.
|
ListIterator<E> |
listIterator()
Returns a
ListIterator for iterating over the set. |
ListIterator<E> |
listIterator(int index)
Returns a
ListIterator for iterating over the set. |
E |
remove(int index)
Removes the item at the specified index.
|
RandomAccessNavigableSet<E> |
subSet(E fromElement,
boolean fromInclusive,
E toElement,
boolean toInclusive) |
RandomAccessNavigableSet<E> |
subSet(E fromElement,
E toElement) |
RandomAccessNavigableSet<E> |
subSetByIndices(int fromIndex,
int toIndex)
Returns the sub-set of elements between the specified starting index (inclusive) and ending
index (exclusive).
|
RandomAccessNavigableSet<E> |
tailSet(E fromElement) |
RandomAccessNavigableSet<E> |
tailSet(E fromElement,
boolean inclusive) |
add, addAll, ceiling, clear, comparator, contains, containsAll, descendingIterator, equals, first, floor, hashCode, higher, isEmpty, iterator, last, lower, pollFirst, pollLast, remove, removeAll, retainAll, size, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
ceiling, descendingIterator, floor, higher, iterator, lower, pollFirst, pollLast
comparator, first, last, spliterator
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, remove, removeAll, retainAll, size, toArray, toArray
parallelStream, removeIf, stream
public DescendingRandomAccessSet(RandomAccessNavigableSet<E> base)
protected RandomAccessNavigableSet<E> base()
base
in class DescendingSet<E>
public E get(int index)
RandomAccessSet
size - 1
.get
in interface RandomAccessSet<E>
index
- the index of the element to retrievepublic int indexOf(Object o)
RandomAccessSet
indexOf
in interface RandomAccessSet<E>
o
- the elementpublic ListIterator<E> listIterator()
RandomAccessSet
ListIterator
for iterating over the set. The iterator will start off before
the first element so the first call to next()
returns the first
element in the set. Iteration is in the same order as that of Set.iterator()
, but allows
for navigating both forwards and backwards in the set and for retrieving the indices of
elements.
Elements cannot be set or added using the returned iterator. These operations will throw
UnsupportedOperationException
s.
listIterator
in interface RandomAccessSet<E>
public ListIterator<E> listIterator(int index)
RandomAccessSet
ListIterator
for iterating over the set. The iterator will start off before
the specified index. Iteration is in the same order as that of Set.iterator()
, but allows
for navigating both forwards and backwards in the set and for retrieving the indices of
elements.
Elements cannot be set or added using the returned iterator. These operations will throw
UnsupportedOperationException
s.
listIterator
in interface RandomAccessSet<E>
public E remove(int index)
RandomAccessSet
remove
in interface RandomAccessSet<E>
index
- the index of the element to removepublic RandomAccessNavigableSet<E> subSetByIndices(int fromIndex, int toIndex)
RandomAccessNavigableSet
Overrides return type to return a navigable set.
subSetByIndices
in interface RandomAccessNavigableSet<E>
subSetByIndices
in interface RandomAccessSet<E>
fromIndex
- the starting index, inclusivetoIndex
- the ending index, exclusivepublic RandomAccessNavigableSet<E> descendingSet()
RandomAccessNavigableSet
Overrides return type to return a random access set.
descendingSet
in interface RandomAccessNavigableSet<E>
descendingSet
in interface NavigableSet<E>
descendingSet
in class DescendingSet<E>
public List<E> asList()
RandomAccessSet
RandomAccessSet.subSetByIndices(int, int)
, the returned view does not support adding or setting
elements.asList
in interface RandomAccessSet<E>
public RandomAccessNavigableSet<E> headSet(E toElement)
RandomAccessNavigableSet
Overrides return type to return a random access set.
headSet
in interface RandomAccessNavigableSet<E>
headSet
in interface NavigableSet<E>
headSet
in interface SortedSet<E>
headSet
in class DescendingSet<E>
public RandomAccessNavigableSet<E> headSet(E toElement, boolean inclusive)
RandomAccessNavigableSet
Overrides return type to return a random access set.
headSet
in interface RandomAccessNavigableSet<E>
headSet
in interface NavigableSet<E>
headSet
in class DescendingSet<E>
public RandomAccessNavigableSet<E> subSet(E fromElement, E toElement)
RandomAccessNavigableSet
Overrides return type to return a random access set.
subSet
in interface RandomAccessNavigableSet<E>
subSet
in interface NavigableSet<E>
subSet
in interface SortedSet<E>
subSet
in class DescendingSet<E>
public RandomAccessNavigableSet<E> subSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive)
RandomAccessNavigableSet
Overrides return type to return a random access set.
subSet
in interface RandomAccessNavigableSet<E>
subSet
in interface NavigableSet<E>
subSet
in class DescendingSet<E>
public RandomAccessNavigableSet<E> tailSet(E fromElement)
RandomAccessNavigableSet
Overrides return type to return a random access set.
tailSet
in interface RandomAccessNavigableSet<E>
tailSet
in interface NavigableSet<E>
tailSet
in interface SortedSet<E>
tailSet
in class DescendingSet<E>
public RandomAccessNavigableSet<E> tailSet(E fromElement, boolean inclusive)
RandomAccessNavigableSet
Overrides return type to return a random access set.
tailSet
in interface RandomAccessNavigableSet<E>
tailSet
in interface NavigableSet<E>
tailSet
in class DescendingSet<E>