@GwtCompatible(serializable=true, emulated=true) final class SingletonImmutableSet<E> extends ImmutableSet<E>
ImmutableSet with exactly one element.ImmutableSet.Builder<E>, ImmutableSet.Indexed<E>ImmutableCollection.ArrayBasedBuilder<E>| Modifier and Type | Field and Description |
|---|---|
private int |
cachedHashCode |
(package private) E |
element |
MAX_TABLE_SIZE| Constructor and Description |
|---|
SingletonImmutableSet(E element) |
SingletonImmutableSet(E element,
int hashCode) |
| Modifier and Type | Method and 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() |
int |
hashCode() |
(package private) boolean |
isHashCodeFast()
Returns
true if the hashCode() method runs quickly. |
(package private) boolean |
isPartialView()
Returns
true if 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.
|
int |
size() |
java.lang.String |
toString() |
asList, builder, chooseTableSize, copyOf, copyOf, copyOf, copyOf, equals, of, of, of, of, of, of, of, writeReplaceadd, addAll, clear, remove, removeAll, retainAll, toArray, toArrayclone, finalize, getClass, notify, notifyAll, wait, wait, waitfinal transient E element
private transient int cachedHashCode
SingletonImmutableSet(E element)
SingletonImmutableSet(E element, int hashCode)
public int size()
public boolean contains(java.lang.Object target)
contains in interface java.util.Collection<E>contains in interface java.util.Set<E>contains in class ImmutableCollection<E>public UnmodifiableIterator<E> iterator()
ImmutableCollectionImmutableList<E> createAsList()
createAsList in class ImmutableSet<E>boolean isPartialView()
ImmutableCollectiontrue 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.isPartialView in class ImmutableCollection<E>int copyIntoArray(java.lang.Object[] dst,
int offset)
ImmutableCollectionoffset + size().copyIntoArray in class ImmutableCollection<E>public final int hashCode()
hashCode in interface java.util.Collection<E>hashCode in interface java.util.Set<E>hashCode in class ImmutableSet<E>boolean isHashCodeFast()
ImmutableSettrue if the hashCode() method runs quickly.isHashCodeFast in class ImmutableSet<E>public java.lang.String toString()
toString in class java.util.AbstractCollection<E>