|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ws4d.java.structures.DataStructure
org.ws4d.java.structures.Set
org.ws4d.java.structures.HashSet
public class HashSet
Constructor Summary | |
---|---|
HashSet()
Constructor. |
|
HashSet(DataStructure data)
|
|
HashSet(int initialCapacity)
|
Method Summary | |
---|---|
boolean |
add(java.lang.Object obj)
Adds a new object to this data structure. |
void |
clear()
Clears this data structure by removing all content from it. |
boolean |
contains(java.lang.Object obj)
Checks whether obj (or another instance equal to
obj in terms of java.lang.Object.equals(Object)
) is already present within this data structure instance and returns
true only if this is the case. |
java.lang.Object |
get(java.lang.Object obj)
Get the object from this HashSet that is equal to the given object. |
boolean |
isEmpty()
Checks whether this instance is empty or not. |
Iterator |
iterator()
Returns an iterator over all items stored within this data structure instance. |
boolean |
remove(java.lang.Object obj)
Removes obj from this data structure. |
int |
size()
Returns the current size of the data structure. |
Methods inherited from class org.ws4d.java.structures.Set |
---|
containsAll, equals, getClassShortName, hashCode |
Methods inherited from class org.ws4d.java.structures.DataStructure |
---|
addAll, toArray, toArray, toString |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public HashSet()
public HashSet(DataStructure data)
data
- public HashSet(int initialCapacity)
Method Detail |
---|
public boolean add(java.lang.Object obj)
DataStructure
add
in class DataStructure
obj
- the object to add
true
if the object was actually added,
false
in any other case (e.g. adding an object to a
set which already contains the same object in terms of
java.lang.Object.equals(Object)
)public java.lang.Object get(java.lang.Object obj)
obj
-
null
if it does not contained an equal objectpublic Iterator iterator()
DataStructure
iterator
in class DataStructure
public int size()
DataStructure
size
in class DataStructure
public boolean isEmpty()
DataStructure
isEmpty
in class DataStructure
true
if this data structure is empty,
false
otherwisepublic void clear()
DataStructure
clear
in class DataStructure
public boolean contains(java.lang.Object obj)
DataStructure
obj
(or another instance equal to
obj
in terms of java.lang.Object.equals(Object)
) is already present within this data structure instance and returns
true
only if this is the case.
contains
in class DataStructure
obj
- the object to check the presence of
true
if obj
is contained by this
instance, false
if notpublic boolean remove(java.lang.Object obj)
DataStructure
obj
from this data structure. Returns
true
if obj
was actually present and thus it
was really removed (i.e. this instance was modified by the method call).
remove
in class DataStructure
obj
- the object to remove
true
only if obj
was actually removed
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |