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

pack-priv final Class ImmutableEnumSet<E extends Enum<E>>

extends ImmutableSet<E extends Enum<E>>
Class Inheritance
Annotations
@GwtCompatible
serializable:true
emulated:true
@SuppressWarnings:serial
@ElementTypesAreNonnullByDefault
Imports
com.google.common.annotations.GwtCompatible, .J2ktIncompatible, com.google.errorprone.annotations.concurrent.LazyInit, java.io.InvalidObjectException, .ObjectInputStream, .Serializable, java.util.Collection, .EnumSet, .Spliterator, java.util.function.Consumer, javax.annotation.CheckForNull

Implementation of ImmutableSet backed by a non-empty java.util.EnumSet.
Author
Jared Levy

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final transient EnumSet<E>
private transient int
Inherited from com.google.common.collect.ImmutableSet:
MAX_TABLE_SIZESPLITERATOR_CHARACTERISTICS

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv static <E extends Enum<E>> ImmutableSet<E>
public boolean
contains(Object
element whose presence in this set is to be tested
object
)

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.
public boolean
containsAll(Collection<?>
collection to be checked for containment in this set
collection
)

Overrides java.util.AbstractCollection.containsAll.

Implements java.util.Set.containsAll, java.util.Collection.containsAll.

Returns true if this set contains all of the elements of the specified collection.
public boolean
equals(Object
object to be compared for equality with this set
object
)

Overrides com.google.common.collect.ImmutableSet.equals.

Implements java.util.Set.equals, java.util.Collection.equals.

Compares the specified object with this set for equality.
public void
forEach(Consumer<? super E>
The action to be performed for each element
action
)

Overrides default java.lang.Iterable.forEach.

Performs the given action for each element of the Iterable until all elements have been processed or the action throws an exception.
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.
public boolean
isEmpty()

Overrides java.util.AbstractCollection.isEmpty.

Implements java.util.Set.isEmpty, java.util.Collection.isEmpty.

Returns true if this set contains no elements.
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.
private void
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.
public String
toString()

Overrides java.util.AbstractCollection.toString.

Returns a string representation of this collection.
pack-priv Object
Inherited from com.google.common.collect.ImmutableSet:
builderbuilderWithExpectedSizechooseTableSizecopyOfcopyOfcopyOfcopyOfofofofofofofoftoImmutableSet

Field Detail

delegateback to summary
private final transient EnumSet<E> delegate
hashCodeback to summary
private transient int hashCode
Annotations
@LazyInit

Constructor Detail

ImmutableEnumSetback to summary
private ImmutableEnumSet(EnumSet<E> delegate)

Method Detail

asImmutableback to summary
pack-priv static <E extends Enum<E>> ImmutableSet<E> asImmutable(EnumSet<E> set)
containsback to summary
public boolean contains(Object object)

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
object:Object

element whose presence in this set is to be tested

Returns:boolean

true if this set contains the specified element

Annotations
@Override
containsAllback to summary
public boolean containsAll(Collection<?> collection)

Overrides java.util.AbstractCollection.containsAll.

Implements java.util.Set.containsAll, java.util.Collection.containsAll.

Doc from java.util.Set.containsAll.

Returns true if this set contains all of the elements of the specified collection. If the specified collection is also a set, this method returns true if it is a subset of this set.

Parameters
collection:Collection<?>

collection to be checked for containment in this set

Returns:boolean

true if this set contains all of the elements of the specified collection

Annotations
@Override
equalsback to summary
public boolean equals(Object object)

Overrides com.google.common.collect.ImmutableSet.equals.

Implements java.util.Set.equals, java.util.Collection.equals.

Doc from java.util.Set.equals.

Compares the specified object with this set for equality. Returns true if the specified object is also a set, the two sets have the same size, and every member of the specified set is contained in this set (or equivalently, every member of this set is contained in the specified set). This definition ensures that the equals method works properly across different implementations of the set interface.

Parameters
object:Object

object to be compared for equality with this set

Returns:boolean

true if the specified object is equal to this set

Annotations
@Override
forEachback to summary
public void forEach(Consumer<? super E> action)

Overrides default java.lang.Iterable.forEach.

Doc from java.lang.Iterable.forEach.

Performs the given action for each element of the Iterable until all elements have been processed or the action throws an exception. Actions are performed in the order of iteration, if that order is specified. Exceptions thrown by the action are relayed to the caller.

The behavior of this method is unspecified if the action performs side-effects that modify the underlying source of elements, unless an overriding class has specified a concurrent modification policy.

Parameters
action:Consumer<? super E>

The action to be performed for each element

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
isEmptyback to summary
public boolean isEmpty()

Overrides java.util.AbstractCollection.isEmpty.

Implements java.util.Set.isEmpty, java.util.Collection.isEmpty.

Doc from java.util.Set.isEmpty.

Returns true if this set contains no elements.

Returns:boolean

true if this set contains no elements

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
@Override
readObjectback to summary
private void readObject(ObjectInputStream stream) throws InvalidObjectException

Hides com.google.common.collect.ImmutableSet.readObject.

Annotations
@J2ktIncompatible
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
toStringback to summary
public String toString()

Overrides java.util.AbstractCollection.toString.

Doc from java.util.AbstractCollection.toString.

Returns a string representation of this collection. The string representation consists of a list of the collection's elements in the order they are returned by its iterator, enclosed in square brackets ("[]"). Adjacent elements are separated by the characters ", " (comma and space). Elements are converted to strings as by String#valueOf(Object).

Returns:String

a string representation of this collection

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

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

Annotations
@Override
@J2ktIncompatible
com.google.common.collect back to summary

private Class ImmutableEnumSet.EnumSerializedForm<E extends Enum<E>>

extends Object
implements Serializable
Class Inheritance
  • java.lang.Object
  • com.google.common.collect.ImmutableEnumSet.EnumSerializedForm
All Implemented Interfaces
java.io.Serializable
Annotations
@J2ktIncompatible

Field Summary

Modifier and TypeField and Description
pack-priv final EnumSet<E>
private static final long

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv Object
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

delegateback to summary
pack-priv final EnumSet<E> delegate
serialVersionUIDback to summary
private static final long serialVersionUID

Constructor Detail

EnumSerializedFormback to summary
pack-priv EnumSerializedForm(EnumSet<E> delegate)

Method Detail

readResolveback to summary
pack-priv Object readResolve()