Iterable<E>, Collection<E>, Set<E>public class ArraySet<E> extends AbstractSet<E> implements Set<E>
| Modifier and Type | Class | Description |
|---|---|---|
static class |
ArraySet.SetFullException |
| Modifier and Type | Field | Description |
|---|---|---|
static int |
MAX_CAPACITY |
| Constructor | Description |
|---|---|
ArraySet() |
A fixed capacity of MAX_CAPACITY.
|
ArraySet(int capacity) |
Adds over capacity will throw a SetFullException.
|
ArraySet(int capacity,
boolean throwOnFull) |
If throwOnFull is false,
adds over capacity will overwrite starting at slot zero.
|
ArraySet(Collection<? extends E> c) |
A fixed capacity of MAX_CAPACITY.
|
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
add(E o) |
|
void |
clear() |
|
boolean |
contains(Object o) |
|
boolean |
isEmpty() |
|
Iterator<E> |
iterator() |
Supports remove.
|
boolean |
remove(Object o) |
|
int |
size() |
addAll, containsAll, retainAll, toArray, toArray, toStringequals, hashCode, removeAllparallelStream, removeIf, streamclone, finalize, getClass, notify, notifyAll, wait, wait, waitaddAll, containsAll, equals, hashCode, removeAll, retainAll, spliterator, toArray, toArraypublic static final int MAX_CAPACITY
public ArraySet()
public ArraySet(Collection<? extends E> c)
ArraySet.SetFullException - if more than MAX_CAPACITY unique elements in c.public ArraySet(int capacity)
capacity - the maximum sizeIllegalArgumentException - if capacity less than 1 or more than MAX_CAPACITY.public ArraySet(int capacity,
boolean throwOnFull)
capacity - the maximum sizeIllegalArgumentException - if capacity less than 1 or more than MAX_CAPACITY.public boolean add(E o)
add in interface Collection<E>add in interface Set<E>add in class AbstractCollection<E>ArraySet.SetFullException - if throwOnFull was true in constructorNullPointerException - if o is nullpublic void clear()
clear in interface Collection<E>clear in interface Set<E>clear in class AbstractCollection<E>public boolean contains(Object o)
contains in interface Collection<E>contains in interface Set<E>contains in class AbstractCollection<E>public boolean isEmpty()
isEmpty in interface Collection<E>isEmpty in interface Set<E>isEmpty in class AbstractCollection<E>public boolean remove(Object o)
remove in interface Collection<E>remove in interface Set<E>remove in class AbstractCollection<E>public int size()
size in interface Collection<E>size in interface Set<E>size in class AbstractCollection<E>