Package com.google.common.collect
Class RegularImmutableAsList<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- com.google.common.collect.ImmutableCollection<E>
-
- com.google.common.collect.ImmutableList<E>
-
- com.google.common.collect.ImmutableAsList<E>
-
- com.google.common.collect.RegularImmutableAsList<E>
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Iterable<E>
,java.util.Collection<E>
,java.util.List<E>
,java.util.RandomAccess
- Direct Known Subclasses:
ImmutableSortedAsList
class RegularImmutableAsList<E> extends ImmutableAsList<E>
AnImmutableAsList
implementation specialized for when the delegate collection is already backed by anImmutableList
or array.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.common.collect.ImmutableAsList
ImmutableAsList.SerializedForm
-
Nested classes/interfaces inherited from class com.google.common.collect.ImmutableList
ImmutableList.Builder<E>, ImmutableList.SubList
-
-
Field Summary
Fields Modifier and Type Field Description private ImmutableCollection<E>
delegate
private ImmutableList<? extends E>
delegateList
-
Fields inherited from class com.google.common.collect.ImmutableCollection
SPLITERATOR_CHARACTERISTICS
-
-
Constructor Summary
Constructors Constructor Description RegularImmutableAsList(ImmutableCollection<E> delegate, ImmutableList<? extends E> delegateList)
RegularImmutableAsList(ImmutableCollection<E> delegate, 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 offset)
Copies the contents of this immutable collection into the specified array at the specified offset.(package private) ImmutableCollection<E>
delegateCollection()
(package private) ImmutableList<? extends E>
delegateList()
void
forEach(java.util.function.Consumer<? super E> action)
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.UnmodifiableListIterator<E>
listIterator(int index)
-
Methods inherited from class com.google.common.collect.ImmutableAsList
contains, isEmpty, isPartialView, size, writeReplace
-
Methods inherited from class com.google.common.collect.ImmutableList
add, addAll, asImmutableList, asImmutableList, asList, builder, builderWithExpectedSize, copyOf, copyOf, copyOf, copyOf, equals, 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, spliterator, subList, subListUnchecked, toImmutableList
-
Methods inherited from class com.google.common.collect.ImmutableCollection
add, addAll, clear, remove, removeAll, removeIf, retainAll, toArray, toArray
-
-
-
-
Field Detail
-
delegate
private final ImmutableCollection<E> delegate
-
delegateList
private final ImmutableList<? extends E> delegateList
-
-
Constructor Detail
-
RegularImmutableAsList
RegularImmutableAsList(ImmutableCollection<E> delegate, ImmutableList<? extends E> delegateList)
-
RegularImmutableAsList
RegularImmutableAsList(ImmutableCollection<E> delegate, java.lang.Object[] array)
-
-
Method Detail
-
delegateCollection
ImmutableCollection<E> delegateCollection()
- Specified by:
delegateCollection
in classImmutableAsList<E>
-
delegateList
ImmutableList<? extends E> delegateList()
-
listIterator
public UnmodifiableListIterator<E> listIterator(int index)
- Specified by:
listIterator
in interfacejava.util.List<E>
- Overrides:
listIterator
in classImmutableList<E>
-
forEach
public void forEach(java.util.function.Consumer<? super E> action)
- Specified by:
forEach
in interfacejava.lang.Iterable<E>
- Overrides:
forEach
in classImmutableList<E>
-
copyIntoArray
int copyIntoArray(java.lang.Object[] dst, int offset)
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>
-
internalArray
@CheckForNull 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>
-
get
public E get(int index)
-
-