|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
T
- The type of item to be stored in the set.public interface Set<T>
An ADT that represents a set: a bunch of items that must be distinct from each other, stored with no defined order.
Method Summary | |
---|---|
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)
Checks whether the given item is in the set. |
Set<T> |
intersect(Set<T> otherSet)
Creates a new Set and returns an intersections of this set and otherSet. |
boolean |
isEmpty()
Returns whether 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. |
Set<T> |
union(Set<T> otherSet)
Creates a new Set and returns a union of this set and otherSet. |
Method Detail |
---|
void add(T item)
boolean remove(T item)
boolean contains(T item)
int size()
boolean isEmpty()
void clear()
Set<T> union(Set<T> otherSet)
otherSet
- A set to combine with this set.
Set<T> intersect(Set<T> otherSet)
otherSet
- A set to combine with this set.
java.util.Iterator<T> iterator()
iterator
in interface java.lang.Iterable<T>
java.lang.Object[] toArray()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |