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.RegularImmutableSet<E>
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Iterable<E>,java.util.Collection<E>,java.util.Set<E>
@GwtCompatible(serializable=true, emulated=true) final class RegularImmutableSet<E> extends ImmutableSet<E>
Implementation ofImmutableSetwith two or more elements.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.common.collect.ImmutableSet
ImmutableSet.Builder<E>, ImmutableSet.Indexed<E>
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Object[]elements(package private) static RegularImmutableSet<java.lang.Object>EMPTYprivate inthashCodeprivate intmask(package private) java.lang.Object[]table-
Fields inherited from class com.google.common.collect.ImmutableSet
HASH_FLOODING_FPP, MAX_RUN_MULTIPLIER, MAX_TABLE_SIZE, SPLITERATOR_CHARACTERISTICS
-
-
Constructor Summary
Constructors Constructor Description RegularImmutableSet(java.lang.Object[] elements, int hashCode, java.lang.Object[] table, int mask)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(java.lang.Object target)(package private) intcopyIntoArray(java.lang.Object[] dst, int offset)Copies the contents of this immutable collection into the specified array at the specified offset.(package private) ImmutableList<E>createAsList()inthashCode()(package private) booleanisHashCodeFast()Returnstrueif thehashCode()method runs quickly.(package private) booleanisPartialView()Returnstrueif this immutable collection's implementation contains references to user-created objects that aren't accessible via this collection's methods.UnmodifiableIterator<E>iterator()Returns an unmodifiable iterator across the elements in this collection.intsize()java.util.Spliterator<E>spliterator()-
Methods inherited from class com.google.common.collect.ImmutableSet
asList, builder, builderWithExpectedSize, chooseTableSize, copyOf, copyOf, copyOf, copyOf, equals, hashFloodingDetected, maxRunBeforeFallback, of, of, of, of, of, of, of, rebuildHashTable, toImmutableSet, writeReplace
-
Methods inherited from class com.google.common.collect.ImmutableCollection
add, addAll, clear, remove, removeAll, removeIf, retainAll, toArray, toArray
-
-
-
-
Field Detail
-
EMPTY
static final RegularImmutableSet<java.lang.Object> EMPTY
-
elements
private final transient java.lang.Object[] elements
-
table
final transient java.lang.Object[] table
-
mask
private final transient int mask
-
hashCode
private final transient int hashCode
-
-
Method Detail
-
contains
public boolean contains(java.lang.Object target)
- Specified by:
containsin interfacejava.util.Collection<E>- Specified by:
containsin interfacejava.util.Set<E>- Specified by:
containsin classImmutableCollection<E>
-
size
public int size()
-
iterator
public UnmodifiableIterator<E> iterator()
Description copied from class:ImmutableCollectionReturns an unmodifiable iterator across the elements in this collection.
-
spliterator
public java.util.Spliterator<E> spliterator()
- Specified by:
spliteratorin interfacejava.util.Collection<E>- Specified by:
spliteratorin interfacejava.lang.Iterable<E>- Specified by:
spliteratorin interfacejava.util.Set<E>- Overrides:
spliteratorin classImmutableCollection<E>
-
copyIntoArray
int copyIntoArray(java.lang.Object[] dst, int offset)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<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 interfacejava.util.Collection<E>- Specified by:
hashCodein interfacejava.util.Set<E>- Overrides:
hashCodein classImmutableSet<E>
-
isHashCodeFast
boolean isHashCodeFast()
Description copied from class:ImmutableSetReturnstrueif thehashCode()method runs quickly.- Overrides:
isHashCodeFastin classImmutableSet<E>
-
-