Package com.google.common.collect
Class RegularImmutableList<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- com.google.common.collect.ImmutableCollection<E>
-
- com.google.common.collect.ImmutableList<E>
-
- com.google.common.collect.RegularImmutableList<E>
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Iterable<E>,java.util.Collection<E>,java.util.List<E>,java.util.RandomAccess
class RegularImmutableList<E> extends ImmutableList<E>
Implementation ofImmutableListbacked by a simple array.
-
-
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 (package private) java.lang.Object[]array(package private) static ImmutableList<java.lang.Object>EMPTY-
Fields inherited from class com.google.common.collect.ImmutableCollection
SPLITERATOR_CHARACTERISTICS
-
-
Constructor Summary
Constructors Constructor Description RegularImmutableList(java.lang.Object[] array)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) intcopyIntoArray(java.lang.Object[] dst, int dstOff)Copies the contents of this immutable collection into the specified array at the specified offset.Eget(int index)(package private) java.lang.Object[]internalArray()If this collection is backed by an array of its elements in insertion order, returns it.(package private) intinternalArrayEnd()If this collection is backed by an array of its elements in insertion order, returns the offset where this collection's elements end.(package private) intinternalArrayStart()If this collection is backed by an array of its elements in insertion order, returns the offset where this collection's elements start.(package private) booleanisPartialView()Returnstrueif this immutable collection's implementation contains references to user-created objects that aren't accessible via this collection's methods.UnmodifiableListIterator<E>listIterator(int index)intsize()java.util.Spliterator<E>spliterator()-
Methods inherited from class com.google.common.collect.ImmutableList
add, addAll, asImmutableList, asImmutableList, asList, builder, builderWithExpectedSize, contains, copyOf, copyOf, copyOf, copyOf, equals, forEach, hashCode, indexOf, iterator, lastIndexOf, listIterator, of, of, of, of, of, of, of, of, of, of, of, of, of, remove, replaceAll, reverse, set, sort, sortedCopyOf, sortedCopyOf, subList, subListUnchecked, toImmutableList, writeReplace
-
Methods inherited from class com.google.common.collect.ImmutableCollection
add, addAll, clear, remove, removeAll, removeIf, retainAll, toArray, toArray
-
-
-
-
Field Detail
-
EMPTY
static final ImmutableList<java.lang.Object> EMPTY
-
array
final transient java.lang.Object[] array
-
-
Method Detail
-
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>
-
internalArray
java.lang.Object[] internalArray()
Description copied from class:ImmutableCollectionIf this collection is backed by an array of its elements in insertion order, returns it.- Overrides:
internalArrayin classImmutableCollection<E>
-
internalArrayStart
int internalArrayStart()
Description copied from class:ImmutableCollectionIf this collection is backed by an array of its elements in insertion order, returns the offset where this collection's elements start.- Overrides:
internalArrayStartin classImmutableCollection<E>
-
internalArrayEnd
int internalArrayEnd()
Description copied from class:ImmutableCollectionIf this collection is backed by an array of its elements in insertion order, returns the offset where this collection's elements end.- Overrides:
internalArrayEndin classImmutableCollection<E>
-
copyIntoArray
int copyIntoArray(java.lang.Object[] dst, int dstOff)Description copied from class:ImmutableCollectionCopies the contents of this immutable collection into the specified array at the specified offset. Returnsoffset + size().- Overrides:
copyIntoArrayin classImmutableList<E>
-
get
public E get(int index)
-
listIterator
public UnmodifiableListIterator<E> listIterator(int index)
- Specified by:
listIteratorin interfacejava.util.List<E>- Overrides:
listIteratorin classImmutableList<E>
-
spliterator
public java.util.Spliterator<E> spliterator()
- Specified by:
spliteratorin interfacejava.util.Collection<E>- Specified by:
spliteratorin interfacejava.lang.Iterable<E>- Specified by:
spliteratorin interfacejava.util.List<E>- Overrides:
spliteratorin classImmutableList<E>
-
-