Package com.google.common.collect
Class RegularImmutableSet<E>
java.lang.Object
java.util.AbstractCollection<E>
com.google.common.collect.ImmutableCollection<E>
com.google.common.collect.ImmutableSet<E>
com.google.common.collect.ImmutableSet.CachingAsList<E>
com.google.common.collect.RegularImmutableSet<E>
- All Implemented Interfaces:
Serializable,Iterable<E>,Collection<E>,Set<E>
Implementation of
ImmutableSet with two or more elements.-
Nested Class Summary
Nested classes/interfaces inherited from class com.google.common.collect.ImmutableSet
ImmutableSet.Builder<E>, ImmutableSet.CachingAsList<E>, ImmutableSet.Indexed<E> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Object[](package private) static final RegularImmutableSet<Object> private static final Object[]private final intprivate final int(package private) final Object[]Fields inherited from class com.google.common.collect.ImmutableSet
MAX_TABLE_SIZE, SPLITERATOR_CHARACTERISTICS -
Constructor Summary
ConstructorsConstructorDescriptionRegularImmutableSet(Object[] elements, int hashCode, Object[] table, int mask) -
Method Summary
Modifier and TypeMethodDescriptionboolean(package private) intcopyIntoArray(Object[] dst, int offset) Copies the contents of this immutable collection into the specified array at the specified offset.(package private) ImmutableList<E> inthashCode()(package private) Object[]If this collection is backed by an array of its elements in insertion order, returns it.(package private) intIf this collection is backed by an array of its elements in insertion order, returns the offset where this collection's elements end.(package private) intIf this collection is backed by an array of its elements in insertion order, returns the offset where this collection's elements start.(package private) booleanReturnstrueif thehashCode()method runs quickly.(package private) booleanReturnstrueif this immutable collection's implementation contains references to user-created objects that aren't accessible via this collection's methods.iterator()Returns an unmodifiable iterator across the elements in this collection.intsize()(package private) ObjectMethods inherited from class com.google.common.collect.ImmutableSet.CachingAsList
asListMethods inherited from class com.google.common.collect.ImmutableSet
builder, builderWithExpectedSize, chooseTableSize, copyOf, copyOf, copyOf, copyOf, equals, of, of, of, of, of, of, of, toImmutableSetMethods inherited from class com.google.common.collect.ImmutableCollection
add, addAll, clear, remove, removeAll, removeIf, retainAll, toArray, toArrayMethods inherited from class java.util.AbstractCollection
containsAll, isEmpty, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Field Details
-
EMPTY_ARRAY
-
EMPTY
-
elements
-
hashCode
private final transient int hashCode -
table
-
mask
private final transient int mask
-
-
Constructor Details
-
RegularImmutableSet
-
-
Method Details
-
contains
- Specified by:
containsin interfaceCollection<E>- Specified by:
containsin interfaceSet<E>- Specified by:
containsin classImmutableCollection<E>
-
size
public int size()- Specified by:
sizein interfaceCollection<E>- Specified by:
sizein interfaceSet<E>- Specified by:
sizein classAbstractCollection<E>
-
iterator
Description copied from class:ImmutableCollectionReturns an unmodifiable iterator across the elements in this collection. -
spliterator
- Specified by:
spliteratorin interfaceCollection<E>- Specified by:
spliteratorin interfaceIterable<E>- Specified by:
spliteratorin interfaceSet<E>- Overrides:
spliteratorin classImmutableCollection<E>
-
internalArray
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
Description copied from class:ImmutableCollectionCopies the contents of this immutable collection into the specified array at the specified offset. Returnsoffset + size().- Overrides:
copyIntoArrayin classImmutableCollection<E>
-
createAsList
ImmutableList<E> createAsList()- Overrides:
createAsListin classImmutableSet.CachingAsList<E>
-
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>
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceCollection<E>- Specified by:
hashCodein interfaceSet<E>- Overrides:
hashCodein classImmutableSet<E>
-
isHashCodeFast
boolean isHashCodeFast()Description copied from class:ImmutableSetReturnstrueif thehashCode()method runs quickly.- Overrides:
isHashCodeFastin classImmutableSet<E>
-
writeReplace
Object writeReplace()- Overrides:
writeReplacein classImmutableSet.CachingAsList<E>
-