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:
Serializable
,Iterable<E>
,Collection<E>
,List<E>
,RandomAccess
,SequencedCollection<E>
- Direct Known Subclasses:
RegularImmutableAsList
List returned by
ImmutableCollection.asList()
that delegates contains
checks to the
backing collection.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class
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 -
Method Summary
Modifier and TypeMethodDescriptionboolean
(package private) abstract ImmutableCollection
<E> boolean
isEmpty()
(package private) boolean
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
(ObjectInputStream stream) int
size()
(package private) Object
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
Methods inherited from class java.util.AbstractCollection
containsAll, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Constructor Details
-
ImmutableAsList
ImmutableAsList()
-
-
Method Details
-
delegateCollection
-
contains
- Specified by:
contains
in interfaceCollection<E>
- Specified by:
contains
in interfaceList<E>
- Overrides:
contains
in classImmutableList<E>
-
size
public int size()- Specified by:
size
in interfaceCollection<E>
- Specified by:
size
in interfaceList<E>
- Specified by:
size
in classAbstractCollection<E>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceCollection<E>
- Specified by:
isEmpty
in interfaceList<E>
- Overrides:
isEmpty
in classAbstractCollection<E>
-
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
- Throws:
InvalidObjectException
-
writeReplace
Object writeReplace()- Overrides:
writeReplace
in classImmutableList<E>
-