private static class ImmutableList.ReverseImmutableList<E> extends ImmutableList<E>
ImmutableList.Builder<E>, ImmutableList.SerializedForm, ImmutableList.SubList
Modifier and Type | Field and Description |
---|---|
private ImmutableList<E> |
forwardList |
SPLITERATOR_CHARACTERISTICS
Constructor and Description |
---|
ReverseImmutableList(ImmutableList<E> backingList) |
Modifier and Type | Method and Description |
---|---|
boolean |
contains(java.lang.Object object) |
E |
get(int index) |
int |
indexOf(java.lang.Object object) |
(package private) boolean |
isPartialView()
Returns
true if this immutable collection's implementation contains references to
user-created objects that aren't accessible via this collection's methods. |
int |
lastIndexOf(java.lang.Object object) |
ImmutableList<E> |
reverse()
Returns a view of this immutable list in reverse order.
|
private int |
reverseIndex(int index) |
private int |
reversePosition(int index) |
int |
size() |
ImmutableList<E> |
subList(int fromIndex,
int toIndex)
Returns an immutable list of the elements between the specified
fromIndex , inclusive,
and toIndex , exclusive. |
add, addAll, asImmutableList, asImmutableList, asList, builder, builderWithExpectedSize, copyIntoArray, copyOf, copyOf, copyOf, copyOf, equals, forEach, hashCode, iterator, listIterator, listIterator, of, of, of, of, of, of, of, of, of, of, of, of, of, remove, replaceAll, set, sort, sortedCopyOf, sortedCopyOf, spliterator, subListUnchecked, toImmutableList, writeReplace
add, addAll, clear, internalArray, internalArrayEnd, internalArrayStart, remove, removeAll, removeIf, retainAll, toArray, toArray
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
private final transient ImmutableList<E> forwardList
ReverseImmutableList(ImmutableList<E> backingList)
private int reverseIndex(int index)
private int reversePosition(int index)
public ImmutableList<E> reverse()
ImmutableList
ImmutableList.of(1,
2, 3).reverse()
is equivalent to ImmutableList.of(3, 2, 1)
.reverse
in class ImmutableList<E>
public boolean contains(@CheckForNull java.lang.Object object)
contains
in interface java.util.Collection<E>
contains
in interface java.util.List<E>
contains
in class ImmutableList<E>
public int indexOf(@CheckForNull java.lang.Object object)
indexOf
in interface java.util.List<E>
indexOf
in class ImmutableList<E>
public int lastIndexOf(@CheckForNull java.lang.Object object)
lastIndexOf
in interface java.util.List<E>
lastIndexOf
in class ImmutableList<E>
public ImmutableList<E> subList(int fromIndex, int toIndex)
ImmutableList
fromIndex
, inclusive,
and toIndex
, exclusive. (If fromIndex
and toIndex
are equal, the empty
immutable list is returned.)subList
in interface java.util.List<E>
subList
in class ImmutableList<E>
public E get(int index)
public int size()
boolean isPartialView()
ImmutableCollection
true
if this immutable collection's implementation contains references to
user-created objects that aren't accessible via this collection's methods. This is generally
used to determine whether copyOf
implementations should make an explicit copy to avoid
memory leaks.isPartialView
in class ImmutableCollection<E>