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:
Serializable,Iterable<E>,Collection<E>,List<E>,RandomAccess,SequencedCollection<E>
- Enclosing class:
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
FieldsFields inherited from class com.google.common.collect.ImmutableCollection
SPLITERATOR_CHARACTERISTICS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanget(int index) int(package private) booleanReturnstrueif this immutable collection's implementation contains references to user-created objects that aren't accessible via this collection's methods.intlastIndexOf(Object object) reverse()Returns a view of this immutable list in reverse order.private intreverseIndex(int index) private intreversePosition(int index) intsize()subList(int fromIndex, int toIndex) Returns an immutable list of the elements between the specifiedfromIndex, inclusive, andtoIndex, exclusive.(package private) ObjectMethods 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, toImmutableListMethods inherited from class com.google.common.collect.ImmutableCollection
add, addAll, clear, internalArray, internalArrayEnd, internalArrayStart, remove, removeAll, removeIf, retainAll, toArray, toArrayMethods inherited from class java.util.AbstractCollection
containsAll, isEmpty, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Field Details
-
forwardList
-
-
Constructor Details
-
ReverseImmutableList
ReverseImmutableList(ImmutableList<E> backingList)
-
-
Method Details
-
reverseIndex
private int reverseIndex(int index) -
reversePosition
private int reversePosition(int index) -
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
- Specified by:
containsin interfaceCollection<E>- Specified by:
containsin interfaceList<E>- Overrides:
containsin classImmutableList<E>
-
indexOf
-
lastIndexOf
- Specified by:
lastIndexOfin interfaceList<E>- Overrides:
lastIndexOfin classImmutableList<E>
-
subList
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.)Note: in almost all circumstances, the returned
ImmutableListretains a strong reference tothis, which may prevent the original list from being garbage collected. If you want the original list to be eligible for garbage collection, you should create and use a copy of the sub list (e.g.,ImmutableList.copyOf(originalList.subList(...))). -
get
-
size
public int size()- Specified by:
sizein interfaceCollection<E>- Specified by:
sizein interfaceList<E>- Specified by:
sizein classAbstractCollection<E>
-
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>
-
writeReplace
Object writeReplace()- Overrides:
writeReplacein classImmutableList<E>
-