public class ArraySet<E> extends AbstractSet<E>
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.
|
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, removeAll
addAll, clear, contains, containsAll, isEmpty, remove, retainAll, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addAll, clear, contains, containsAll, isEmpty, remove, retainAll, spliterator, toArray, toArray
parallelStream, removeIf, stream
public ArraySet()
public ArraySet(int initialSize)
initialSize
- initial size of the backing array.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>