private static class DefaultImmutableSet.NILSet<T> extends DefaultImmutableSet<T>
| Modifier and Type | Field and Description |
|---|---|
(package private) static DefaultImmutableSet.NILSet<?> |
NIL |
private static long |
serialVersionUID |
UNION_OPTIMIZATION_SIZE| Modifier | Constructor and Description |
|---|---|
private |
NILSet() |
| Modifier and Type | Method and Description |
|---|---|
ImmutableSet<T> |
add(T element)
adds an element
|
ImmutableSet<T> |
addUnique(T element)
adds an element (which is unique, since the set was empty)
|
boolean |
contains(T obj) |
boolean |
equals(Object o) |
int |
hashCode() |
boolean |
isEmpty() |
Iterator<T> |
iterator() |
private Object |
readResolve()
the NIL list is a singleton.
|
ImmutableSet<T> |
remove(T element) |
int |
size() |
boolean |
subset(ImmutableSet<T> s) |
<S> S[] |
toArray(S[] array)
Convert the set to a Java array (O(n))
|
String |
toString() |
ImmutableSet<T> |
union(ImmutableSet<T> set) |
fromImmutableList, intersect, nil, toImmutableListclone, finalize, getClass, notify, notifyAll, wait, wait, waitforEach, spliteratorprivate static final long serialVersionUID
static final DefaultImmutableSet.NILSet<?> NIL
private Object readResolve() throws ObjectStreamException
ObjectStreamExceptionpublic ImmutableSet<T> add(T element)
add in interface ImmutableSet<T>add in class DefaultImmutableSet<T>element - of type public ImmutableSet<T> addUnique(T element)
addUnique in interface ImmutableSet<T>addUnique in class DefaultImmutableSet<T>element - of type public ImmutableSet<T> union(ImmutableSet<T> set)
union in interface ImmutableSet<T>union in class DefaultImmutableSet<T>public boolean contains(T obj)
contains in interface ImmutableSet<T>contains in class DefaultImmutableSet<T>public Iterator<T> iterator()
iterator in interface Iterable<T>iterator in interface ImmutableSet<T>iterator in class DefaultImmutableSet<T>public boolean subset(ImmutableSet<T> s)
subset in interface ImmutableSet<T>subset in class DefaultImmutableSet<T>public int size()
size in interface ImmutableSet<T>size in class DefaultImmutableSet<T>public boolean isEmpty()
isEmpty in interface ImmutableSet<T>isEmpty in class DefaultImmutableSet<T>public boolean equals(Object o)
equals in interface ImmutableSet<T>equals in class DefaultImmutableSet<T>public int hashCode()
hashCode in interface ImmutableSet<T>hashCode in class DefaultImmutableSet<T>public String toString()
toString in class DefaultImmutableSet<T>public ImmutableSet<T> remove(T element)
remove in interface ImmutableSet<T>remove in class DefaultImmutableSet<T>public <S> S[] toArray(S[] array)
DefaultImmutableSettoArray in interface ImmutableSet<T>toArray in class DefaultImmutableSet<T>