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 ofImmutableList
backed 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) int
copyIntoArray(java.lang.Object[] dst, int dstOff)
Copies the contents of this immutable collection into the specified array at the specified offset.E
get(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) int
internalArrayEnd()
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) int
internalArrayStart()
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) boolean
isPartialView()
Returnstrue
if 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)
int
size()
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: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>
-
internalArray
java.lang.Object[] internalArray()
Description copied from class:ImmutableCollection
If this collection is backed by an array of its elements in insertion order, returns it.- Overrides:
internalArray
in classImmutableCollection<E>
-
internalArrayStart
int internalArrayStart()
Description copied from class:ImmutableCollection
If this collection is backed by an array of its elements in insertion order, returns the offset where this collection's elements start.- Overrides:
internalArrayStart
in classImmutableCollection<E>
-
internalArrayEnd
int internalArrayEnd()
Description copied from class:ImmutableCollection
If this collection is backed by an array of its elements in insertion order, returns the offset where this collection's elements end.- Overrides:
internalArrayEnd
in classImmutableCollection<E>
-
copyIntoArray
int copyIntoArray(java.lang.Object[] dst, int dstOff)
Description copied from class:ImmutableCollection
Copies the contents of this immutable collection into the specified array at the specified offset. Returnsoffset + size()
.- Overrides:
copyIntoArray
in classImmutableList<E>
-
get
public E get(int index)
-
listIterator
public UnmodifiableListIterator<E> listIterator(int index)
- Specified by:
listIterator
in interfacejava.util.List<E>
- Overrides:
listIterator
in classImmutableList<E>
-
spliterator
public java.util.Spliterator<E> spliterator()
- Specified by:
spliterator
in interfacejava.util.Collection<E>
- Specified by:
spliterator
in interfacejava.lang.Iterable<E>
- Specified by:
spliterator
in interfacejava.util.List<E>
- Overrides:
spliterator
in classImmutableList<E>
-
-