Constructor and Description |
---|
OpenHashSet()
Default constructor uses a hash table with size 16.
|
OpenHashSet(int s)
Constructor receives table size as input.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(E e)
Reports whether a given element belongs to this set.
|
void |
include(E e)
Adds an input element to this set, throwing an
ElementFoundException if this element already belongs
to it.
|
void |
remove(E e)
Removes an input element to this set, throwing a
NoSuchElementException if this element does not belong to it.
|
public OpenHashSet()
public OpenHashSet(int s)
s
- size of hash table to be usedjava.lang.IllegalArgumentException
- if s is not positivepublic boolean contains(E e)
Set
contains
in interface Set<E>
e
- the element to be searched forpublic void include(E e) throws ElementFoundException
Set
include
in interface Set<E>
e
- the element to be added to this setElementFoundException
- if this element is already in the set
public void remove(E e) throws java.util.NoSuchElementException
Set
remove
in interface Set<E>
e
- the element to be removed from this setjava.util.NoSuchElementException
- if this element was not in this set