T
- The type of item to be stored in the set.public interface Set<T>
extends java.lang.Iterable<T>
Modifier and Type | Method and Description |
---|---|
void |
add(T item)
Adds the given item to the set, ignoring duplicates.
|
void |
clear()
Removes all items from the set.
|
boolean |
contains(T item)
Returns whether the given item is in the set.
|
boolean |
isEmpty()
Returns true if the set is empty.
|
java.util.Iterator<T> |
iterator()
Returns an iterator over the items in the set (which will access the
items in some arbitrary order).
|
boolean |
remove(T item)
Removes the given item.
|
int |
size()
Returns the number of items in the set.
|
java.lang.Object[] |
toArray()
Returns an array containing the same contents as this set, in an
arbitrary order.
|
void add(T item)
boolean remove(T item)
boolean contains(T item)
int size()
boolean isEmpty()
void clear()
java.util.Iterator<T> iterator()
iterator
in interface java.lang.Iterable<T>
java.lang.Object[] toArray()