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.Indexed<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.Indexed<E>
Implementation ofImmutableSet
with two or more elements.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.common.collect.ImmutableSet
ImmutableSet.Builder<E>, ImmutableSet.Indexed<E>
-
Nested classes/interfaces inherited from class com.google.common.collect.ImmutableCollection
ImmutableCollection.ArrayBasedBuilder<E>
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Object[]
elements
(package private) static RegularImmutableSet<java.lang.Object>
EMPTY
private int
hashCode
private int
mask
(package private) java.lang.Object[]
table
-
Fields inherited from class com.google.common.collect.ImmutableSet
MAX_TABLE_SIZE
-
-
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 boolean
contains(java.lang.Object target)
(package private) int
copyIntoArray(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()
(package private) E
get(int i)
int
hashCode()
(package private) boolean
isHashCodeFast()
Returnstrue
if thehashCode()
method runs quickly.(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.int
size()
-
Methods inherited from class com.google.common.collect.ImmutableSet.Indexed
iterator
-
Methods inherited from class com.google.common.collect.ImmutableSet
asList, builder, chooseTableSize, copyOf, copyOf, copyOf, copyOf, equals, of, of, of, of, of, of, of, writeReplace
-
Methods inherited from class com.google.common.collect.ImmutableCollection
add, addAll, clear, remove, removeAll, 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(@Nullable java.lang.Object target)
- Specified by:
contains
in interfacejava.util.Collection<E>
- Specified by:
contains
in interfacejava.util.Set<E>
- Specified by:
contains
in classImmutableCollection<E>
-
size
public int size()
-
get
E get(int i)
- Specified by:
get
in classImmutableSet.Indexed<E>
-
copyIntoArray
int copyIntoArray(java.lang.Object[] dst, int offset)
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.Indexed<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 interfacejava.util.Collection<E>
- Specified by:
hashCode
in interfacejava.util.Set<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>
-
-