|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectSet<K>
K
- The type of the elements in the set.public class Set<K>
A set is like a Map
without data, i.e.
it is a collection of elements without duplicates.
(Where Object.equals(Object)
is used to compare elements).
Internally, the keys of a Map are used to store
the elements of the set. Note that it depends on
the Map whether null is supported as element.
Constructor Summary | |
---|---|
Set()
Creates a new empty set. |
|
Set(Map<K,?> m)
Creates a set where the elements are the keys of the given map. |
Method Summary | |
---|---|
Array<K> |
array()
Creates a new array which stores all elements of this set. |
void |
delete(K k)
Deletes an element k from the set if it is present in the set. |
void |
insert(K k)
Inserts an element k into the set. |
boolean |
iselement(K k)
Checks whether the given element is in the set. |
SimpleIterator<K> |
iterator()
Gives an iterator over all elements in the set. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Set()
Hashtable
is used to store the elements)
public Set(Map<K,?> m)
m
- The map which defines this set.Method Detail |
---|
public void insert(K k)
k
- The element to insert.public void delete(K k)
k
- The element to delete.public boolean iselement(K k)
k
- The element to check.
public SimpleIterator<K> iterator()
public Array<K> array()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |