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 int
private 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) int
copyIntoArray
(Object[] dst, int offset) Copies the contents of this immutable collection into the specified array at the specified offset.(package private) ImmutableList
<E> int
hashCode()
(package private) Object[]
If this collection is backed by an array of its elements in insertion order, returns it.(package private) int
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
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
Returnstrue
if thehashCode()
method runs quickly.(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.iterator()
Returns an unmodifiable iterator across the elements in this collection.int
size()
(package private) Object
Methods inherited from class com.google.common.collect.ImmutableSet.CachingAsList
asList
Methods inherited from class com.google.common.collect.ImmutableSet
builder, builderWithExpectedSize, chooseTableSize, copyOf, copyOf, copyOf, copyOf, equals, of, of, of, of, of, of, of, toImmutableSet
Methods inherited from class com.google.common.collect.ImmutableCollection
add, addAll, clear, remove, removeAll, removeIf, retainAll, toArray, toArray
Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty, 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
-
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:
contains
in interfaceCollection<E>
- Specified by:
contains
in interfaceSet<E>
- Specified by:
contains
in classImmutableCollection<E>
-
size
public int size()- Specified by:
size
in interfaceCollection<E>
- Specified by:
size
in interfaceSet<E>
- Specified by:
size
in classAbstractCollection<E>
-
iterator
Description copied from class:ImmutableCollection
Returns an unmodifiable iterator across the elements in this collection. -
spliterator
- Specified by:
spliterator
in interfaceCollection<E>
- Specified by:
spliterator
in interfaceIterable<E>
- Specified by:
spliterator
in interfaceSet<E>
- Overrides:
spliterator
in classImmutableCollection<E>
-
internalArray
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
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 classImmutableCollection<E>
-
createAsList
ImmutableList<E> createAsList()- Overrides:
createAsList
in classImmutableSet.CachingAsList<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>
-
hashCode
public int hashCode()- Specified by:
hashCode
in interfaceCollection<E>
- Specified by:
hashCode
in interfaceSet<E>
- Overrides:
hashCode
in classImmutableSet<E>
-
isHashCodeFast
boolean isHashCodeFast()Description copied from class:ImmutableSet
Returnstrue
if thehashCode()
method runs quickly.- Overrides:
isHashCodeFast
in classImmutableSet<E>
-
writeReplace
Object writeReplace()- Overrides:
writeReplace
in classImmutableSet.CachingAsList<E>
-