X - the type of object in this singleton.public final class Singleton<X>
extends java.lang.Object
implements java.util.Set<X>
Singleton, i.e., a singleton,
is an unmodifiable set that contains only one element.| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
UNMODIFIABLE_MESSAGE
The (string) message that indicates that the set cannot be modified.
|
| Constructor and Description |
|---|
Singleton(X x)
Builds the singleton that contains the specified element.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(X e) |
boolean |
addAll(java.util.Collection<? extends X> c) |
void |
clear() |
boolean |
contains(java.lang.Object o) |
boolean |
containsAll(java.util.Collection<?> c) |
boolean |
isEmpty() |
java.util.Iterator<X> |
iterator() |
boolean |
remove(java.lang.Object o) |
boolean |
removeAll(java.util.Collection<?> c) |
boolean |
retainAll(java.util.Collection<?> c) |
int |
size() |
java.lang.Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
public static final java.lang.String UNMODIFIABLE_MESSAGE
public Singleton(X x)
x - the element in this singleton.public int size()
public boolean isEmpty()
public boolean contains(java.lang.Object o)
public java.util.Iterator<X> iterator()
public java.lang.Object[] toArray()
public <T> T[] toArray(T[] a)
public boolean add(X e)
public boolean remove(java.lang.Object o)
public boolean containsAll(java.util.Collection<?> c)
public boolean addAll(java.util.Collection<? extends X> c)
public boolean retainAll(java.util.Collection<?> c)
public boolean removeAll(java.util.Collection<?> c)