| Constructor and Description |
|---|
HashSet()
Constructor.
|
HashSet(DataStructure data) |
HashSet(int initialCapacity) |
| Modifier and Type | Method and Description |
|---|---|
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.
|
containsAll, equals, getClassShortName, hashCodeaddAll, toArray, toArray, toStringpublic HashSet()
public HashSet(DataStructure data)
data - public HashSet(int initialCapacity)
public boolean add(java.lang.Object obj)
DataStructureadd in class DataStructureobj - the object to addtrue 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()
DataStructureiterator in class DataStructurepublic int size()
DataStructuresize in class DataStructurepublic boolean isEmpty()
DataStructureisEmpty in class DataStructuretrue if this data structure is empty, false otherwisepublic void clear()
DataStructureclear in class DataStructurepublic boolean contains(java.lang.Object obj)
DataStructureobj (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 DataStructureobj - the object to check the presence oftrue if obj is contained by this instance, false if notpublic boolean remove(java.lang.Object obj)
DataStructureobj 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 DataStructureobj - the object to removetrue only if obj was actually removed