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 booleancontains(java.lang.Object object)Eget(int index)intindexOf(java.lang.Object object)(package private) booleanisPartialView()Returnstrueif this immutable collection's implementation contains references to user-created objects that aren't accessible via this collection's methods.intlastIndexOf(java.lang.Object object)ImmutableList<E>reverse()Returns a view of this immutable list in reverse order.private intreverseIndex(int index)private intreversePosition(int index)intsize()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:ImmutableListReturns 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:
reversein classImmutableList<E>- Returns:
- a view of this immutable list in reverse order
-
contains
public boolean contains(java.lang.Object object)
- Specified by:
containsin interfacejava.util.Collection<E>- Specified by:
containsin interfacejava.util.List<E>- Overrides:
containsin classImmutableList<E>
-
indexOf
public int indexOf(java.lang.Object object)
- Specified by:
indexOfin interfacejava.util.List<E>- Overrides:
indexOfin classImmutableList<E>
-
lastIndexOf
public int lastIndexOf(java.lang.Object object)
- Specified by:
lastIndexOfin interfacejava.util.List<E>- Overrides:
lastIndexOfin classImmutableList<E>
-
subList
public ImmutableList<E> subList(int fromIndex, int toIndex)
Description copied from class:ImmutableListReturns an immutable list of the elements between the specifiedfromIndex, inclusive, andtoIndex, exclusive. (IffromIndexandtoIndexare equal, the empty immutable list is returned.)- Specified by:
subListin interfacejava.util.List<E>- Overrides:
subListin classImmutableList<E>
-
get
public E get(int index)
-
size
public int size()
-
isPartialView
boolean isPartialView()
Description copied from class:ImmutableCollectionReturnstrueif 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 whethercopyOfimplementations should make an explicit copy to avoid memory leaks.- Specified by:
isPartialViewin classImmutableCollection<E>
-
-