Package com.google.common.collect
Class ImmutableList.ReverseImmutableList<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- com.google.common.collect.ImmutableCollection<E>
-
- com.google.common.collect.ImmutableList<E>
-
- com.google.common.collect.ImmutableList.ReverseImmutableList<E>
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Iterable<E>
,java.util.Collection<E>
,java.util.List<E>
,java.util.RandomAccess
- Enclosing class:
- ImmutableList<E>
private static class ImmutableList.ReverseImmutableList<E> extends ImmutableList<E>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.common.collect.ImmutableList
ImmutableList.Builder<E>, ImmutableList.SerializedForm, ImmutableList.SubList
-
-
Field Summary
Fields Modifier and Type Field Description private ImmutableList<E>
forwardList
-
Fields inherited from class com.google.common.collect.ImmutableCollection
SPLITERATOR_CHARACTERISTICS
-
-
Constructor Summary
Constructors Constructor Description ReverseImmutableList(ImmutableList<E> backingList)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(java.lang.Object object)
E
get(int index)
int
indexOf(java.lang.Object object)
(package private) boolean
isPartialView()
Returnstrue
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 specifiedfromIndex
, inclusive, andtoIndex
, exclusive.-
Methods inherited from class com.google.common.collect.ImmutableList
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
-
Methods inherited from class com.google.common.collect.ImmutableCollection
add, addAll, clear, internalArray, internalArrayEnd, internalArrayStart, remove, removeAll, removeIf, retainAll, toArray, toArray
-
-
-
-
Field Detail
-
forwardList
private final transient ImmutableList<E> forwardList
-
-
Constructor Detail
-
ReverseImmutableList
ReverseImmutableList(ImmutableList<E> backingList)
-
-
Method Detail
-
reverseIndex
private int reverseIndex(int index)
-
reversePosition
private int reversePosition(int index)
-
reverse
public ImmutableList<E> reverse()
Description copied from class:ImmutableList
Returns a view of this immutable list in reverse order. For example,ImmutableList.of(1, 2, 3).reverse()
is equivalent toImmutableList.of(3, 2, 1)
.- Overrides:
reverse
in classImmutableList<E>
- Returns:
- a view of this immutable list in reverse order
-
contains
public boolean contains(java.lang.Object object)
- Specified by:
contains
in interfacejava.util.Collection<E>
- Specified by:
contains
in interfacejava.util.List<E>
- Overrides:
contains
in classImmutableList<E>
-
indexOf
public int indexOf(java.lang.Object object)
- Specified by:
indexOf
in interfacejava.util.List<E>
- Overrides:
indexOf
in classImmutableList<E>
-
lastIndexOf
public int lastIndexOf(java.lang.Object object)
- Specified by:
lastIndexOf
in interfacejava.util.List<E>
- Overrides:
lastIndexOf
in classImmutableList<E>
-
subList
public ImmutableList<E> subList(int fromIndex, int toIndex)
Description copied from class:ImmutableList
Returns an immutable list of the elements between the specifiedfromIndex
, inclusive, andtoIndex
, exclusive. (IffromIndex
andtoIndex
are equal, the empty immutable list is returned.)- Specified by:
subList
in interfacejava.util.List<E>
- Overrides:
subList
in classImmutableList<E>
-
get
public E get(int index)
-
size
public int size()
-
isPartialView
boolean isPartialView()
Description copied from class:ImmutableCollection
Returnstrue
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 whethercopyOf
implementations should make an explicit copy to avoid memory leaks.- Specified by:
isPartialView
in classImmutableCollection<E>
-
-