public class ArraySet<E> extends AbstractSet<E> implements Serializable
| Constructor and Description |
|---|
ArraySet()
Constructs an ArraySet.
|
ArraySet(E... elements)
Constructs an ArraySet with the specified elements.
|
ArraySet(int initialSize)
Constructs an ArraySet with specified initial size of backing array.
|
ArraySet(List<E> source)
Constructs an ArraySet, using the given list as the backing collection.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E e)
Adds element to set.
|
Iterator<E> |
iterator()
Returns iterator over elements of the set.
|
int |
size()
Returns size of set.
|
equals, hashCode, removeAlladdAll, clear, contains, containsAll, isEmpty, remove, retainAll, toArray, toArray, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitaddAll, clear, contains, containsAll, isEmpty, remove, retainAll, spliterator, toArray, toArrayparallelStream, removeIf, streampublic ArraySet()
public ArraySet(List<E> source)
public ArraySet(int initialSize)
initialSize - initial size of the backing array.@SafeVarargs public ArraySet(E... elements)
elements - the elements to be put in the set.public boolean add(E e)
add in interface Collection<E>add in interface Set<E>add in class AbstractCollection<E>e - the element to be added.false if the set already contained (vis. .equals()) the specified element; true otherwise.public int size()
size in interface Collection<E>size in interface Set<E>size in class AbstractCollection<E>