Top Description Fields Constructors Methods
com.google.common.collect

pack-priv final Class RegularImmutableSet<E>

extends ImmutableSet.CachingAsList<E>
Class Inheritance
Annotations
@GwtCompatible
serializable:true
emulated:true
@SuppressWarnings:serial
@ElementTypesAreNonnullByDefault
Imports
com.google.common.annotations.GwtCompatible, .GwtIncompatible, .J2ktIncompatible, .VisibleForTesting, java.util.Spliterator, .Spliterators, javax.annotation.CheckForNull, org.checkerframework.checker.nullness.qual.Nullable

Implementation of ImmutableSet with two or more elements.
Author
Kevin Bourrillion

Field Summary

Modifier and TypeField and Description
private final transient Object[]
pack-priv static final RegularImmutableSet<Object>
private static final Object[]
private final transient int
private final transient int
pack-priv final transient @Nullable Object[]

Constructor Summary

AccessConstructor and Description
pack-priv
RegularImmutableSet(Object[] elements, int hashCode, @Nullable Object[] table, int mask)

Method Summary

Modifier and TypeMethod and Description
public boolean
contains(Object
element whose presence in this set is to be tested
target
)

Implements abstract com.google.common.collect.ImmutableCollection.contains.

Implements java.util.Set.contains, java.util.Collection.contains.

Returns true if this set contains the specified element.
pack-priv int
copyIntoArray(@Nullable Object[] dst, int offset)

pack-priv ImmutableList<E>
public int
hashCode()

Overrides com.google.common.collect.ImmutableSet.hashCode.

Implements java.util.Set.hashCode, java.util.Collection.hashCode.

Returns the hash code value for this set.
pack-priv Object[]
internalArray()

Overrides com.google.common.collect.ImmutableCollection.internalArray.

If this collection is backed by an array of its elements in insertion order, returns it.
pack-priv int
internalArrayEnd()

Overrides com.google.common.collect.ImmutableCollection.internalArrayEnd.

If this collection is backed by an array of its elements in insertion order, returns the offset where this collection's elements end.
pack-priv int
internalArrayStart()

Overrides com.google.common.collect.ImmutableCollection.internalArrayStart.

If this collection is backed by an array of its elements in insertion order, returns the offset where this collection's elements start.
pack-priv boolean
isHashCodeFast()

Overrides com.google.common.collect.ImmutableSet.isHashCodeFast.

Returns true if the hashCode() method runs quickly.
pack-priv boolean
isPartialView()

Implements abstract com.google.common.collect.ImmutableCollection.isPartialView.

Returns true if this immutable collection's implementation contains references to user-created objects that aren't accessible via this collection's methods.
public UnmodifiableIterator<E>
iterator()

Implements abstract com.google.common.collect.ImmutableSet.iterator.

Implements java.util.Set.iterator, java.util.Collection.iterator.

Returns an iterator over the elements in this set.
public int
size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.Set.size, java.util.Collection.size.

Returns the number of elements in this set (its cardinality).
public Spliterator<E>
spliterator()

Overrides com.google.common.collect.ImmutableCollection.spliterator.

Overrides default java.util.Set.spliterator, java.util.Collection.spliterator.

Creates a Spliterator over the elements in this set.
pack-priv Object
Inherited from com.google.common.collect.ImmutableSet.CachingAsList:
asList

Field Detail

elementsback to summary
private final transient Object[] elements
EMPTYback to summary
pack-priv static final RegularImmutableSet<Object> EMPTY
EMPTY_ARRAYback to summary
private static final Object[] EMPTY_ARRAY

Hides com.google.common.collect.ImmutableCollection.EMPTY_ARRAY.

hashCodeback to summary
private final transient int hashCode
maskback to summary
private final transient int mask
tableback to summary
pack-priv final transient @Nullable Object[] table
Annotations
@VisibleForTesting

Constructor Detail

RegularImmutableSetback to summary
pack-priv RegularImmutableSet(Object[] elements, int hashCode, @Nullable Object[] table, int mask)

Method Detail

containsback to summary
public boolean contains(Object target)

Implements abstract com.google.common.collect.ImmutableCollection.contains.

Implements java.util.Set.contains, java.util.Collection.contains.

Doc from java.util.Set.contains.

Returns true if this set contains the specified element. More formally, returns true if and only if this set contains an element e such that Objects.equals(o, e).

Parameters
target:Object

element whose presence in this set is to be tested

Returns:boolean

true if this set contains the specified element

Annotations
@Override
copyIntoArrayback to summary
pack-priv int copyIntoArray(@Nullable Object[] dst, int offset)
Annotations
@Override
createAsListback to summary
pack-priv ImmutableList<E> createAsList()

Overrides com.google.common.collect.ImmutableSet.CachingAsList.createAsList.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides com.google.common.collect.ImmutableSet.hashCode.

Implements java.util.Set.hashCode, java.util.Collection.hashCode.

Doc from java.util.Set.hashCode.

Returns the hash code value for this set. The hash code of a set is defined to be the sum of the hash codes of the elements in the set, where the hash code of a null element is defined to be zero. This ensures that s1.equals(s2) implies that s1.hashCode()==s2.hashCode() for any two sets s1 and s2, as required by the general contract of Object#hashCode.

Returns:int

the hash code value for this set

Annotations
@Override
internalArrayback to summary
pack-priv Object[] internalArray()

Overrides com.google.common.collect.ImmutableCollection.internalArray.

Doc from com.google.common.collect.ImmutableCollection.internalArray.

If this collection is backed by an array of its elements in insertion order, returns it.

Annotations
@Override
internalArrayEndback to summary
pack-priv int internalArrayEnd()

Overrides com.google.common.collect.ImmutableCollection.internalArrayEnd.

Doc from com.google.common.collect.ImmutableCollection.internalArrayEnd.

If this collection is backed by an array of its elements in insertion order, returns the offset where this collection's elements end.

Annotations
@Override
internalArrayStartback to summary
pack-priv int internalArrayStart()

Overrides com.google.common.collect.ImmutableCollection.internalArrayStart.

Doc from com.google.common.collect.ImmutableCollection.internalArrayStart.

If this collection is backed by an array of its elements in insertion order, returns the offset where this collection's elements start.

Annotations
@Override
isHashCodeFastback to summary
pack-priv boolean isHashCodeFast()

Overrides com.google.common.collect.ImmutableSet.isHashCodeFast.

Doc from com.google.common.collect.ImmutableSet.isHashCodeFast.

Returns true if the hashCode() method runs quickly.

Annotations
@Override
isPartialViewback to summary
pack-priv boolean isPartialView()

Implements abstract com.google.common.collect.ImmutableCollection.isPartialView.

Doc from com.google.common.collect.ImmutableCollection.isPartialView.

Returns true 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 whether copyOf implementations should make an explicit copy to avoid memory leaks.

Annotations
@Override
iteratorback to summary
public UnmodifiableIterator<E> iterator()

Implements abstract com.google.common.collect.ImmutableSet.iterator.

Implements java.util.Set.iterator, java.util.Collection.iterator.

Doc from java.util.Set.iterator.

Returns an iterator over the elements in this set. The elements are returned in no particular order (unless this set is an instance of some class that provides a guarantee).

Returns:UnmodifiableIterator<E>

an iterator over the elements in this set

Annotations
@SuppressWarnings:unchecked
@Override
sizeback to summary
public int size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.Set.size, java.util.Collection.size.

Doc from java.util.Set.size.

Returns the number of elements in this set (its cardinality). If this set contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.

Returns:int

the number of elements in this set (its cardinality)

Annotations
@Override
spliteratorback to summary
public Spliterator<E> spliterator()

Overrides com.google.common.collect.ImmutableCollection.spliterator.

Overrides default java.util.Set.spliterator, java.util.Collection.spliterator.

Doc from java.util.Set.spliterator.

Creates a Spliterator over the elements in this set.

The Spliterator reports Spliterator#DISTINCT. Implementations should document the reporting of additional characteristic values.

Returns:Spliterator<E>

a Spliterator over the elements in this set

Annotations
@Override
writeReplaceback to summary
pack-priv Object writeReplace()

Overrides com.google.common.collect.ImmutableSet.CachingAsList.writeReplace.

Annotations
@SuppressWarnings:RedundantOverride
@Override
@J2ktIncompatible
@GwtIncompatible