Package com.google.common.collect
Class ImmutableAsList<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>
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Iterable<E>
,java.util.Collection<E>
,java.util.List<E>
,java.util.RandomAccess
- Direct Known Subclasses:
RegularImmutableAsList
abstract class ImmutableAsList<E> extends ImmutableList<E>
List returned byImmutableCollection.asList()
that delegatescontains
checks to the backing collection.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
ImmutableAsList.SerializedForm
Serialized form that leads to the same performance as the original list.-
Nested classes/interfaces inherited from class com.google.common.collect.ImmutableList
ImmutableList.Builder<E>, ImmutableList.SubList
-
-
Field Summary
-
Fields inherited from class com.google.common.collect.ImmutableCollection
SPLITERATOR_CHARACTERISTICS
-
-
Constructor Summary
Constructors Constructor Description ImmutableAsList()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
contains(java.lang.Object target)
(package private) abstract ImmutableCollection<E>
delegateCollection()
boolean
isEmpty()
(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.private void
readObject(java.io.ObjectInputStream stream)
int
size()
(package private) java.lang.Object
writeReplace()
-
Methods inherited from class com.google.common.collect.ImmutableList
add, addAll, asImmutableList, asImmutableList, asList, builder, builderWithExpectedSize, copyIntoArray, copyOf, copyOf, copyOf, copyOf, equals, forEach, hashCode, indexOf, iterator, lastIndexOf, listIterator, 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, internalArray, internalArrayEnd, internalArrayStart, remove, removeAll, removeIf, retainAll, toArray, toArray
-
-
-
-
Method Detail
-
delegateCollection
abstract ImmutableCollection<E> delegateCollection()
-
contains
public boolean contains(@CheckForNull java.lang.Object target)
- Specified by:
contains
in interfacejava.util.Collection<E>
- Specified by:
contains
in interfacejava.util.List<E>
- Overrides:
contains
in classImmutableList<E>
-
size
public int size()
-
isEmpty
public boolean isEmpty()
-
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>
-
readObject
private void readObject(java.io.ObjectInputStream stream) throws java.io.InvalidObjectException
- Throws:
java.io.InvalidObjectException
-
writeReplace
java.lang.Object writeReplace()
- Overrides:
writeReplace
in classImmutableList<E>
-
-