Package org.yamcs.utils
Class IntHashSet
java.lang.Object
org.yamcs.utils.IntHashSet
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs an empty IntHashSet with the default capacity.Constructs a new IntHashSet and initializes it with values from the given IntArray. -
Method Summary
Modifier and TypeMethodDescriptionboolean
add
(int value) Adds a value to the set if it is not already present.clone()
Creates and returns a copy of this IntHashSet.boolean
contains
(int value) Checks whether the set contains the given value.iterator()
Returns an iterator over the elements in this set.boolean
remove
(int value) Removes the specified value from the set if it exists.int
size()
Returns the number of elements currently in the set.toString()
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
IntHashSet
Constructs a new IntHashSet and initializes it with values from the given IntArray.- Parameters:
a
- the IntArray containing initial values for the set
-
IntHashSet
public IntHashSet()Constructs an empty IntHashSet with the default capacity.
-
-
Method Details
-
add
public boolean add(int value) Adds a value to the set if it is not already present.- Parameters:
value
- the value to be added- Returns:
- true if the value was added, false if it was already present
-
contains
public boolean contains(int value) Checks whether the set contains the given value.- Parameters:
value
- the value to check for presence in the set- Returns:
- true if the value is present, false otherwise
-
remove
public boolean remove(int value) Removes the specified value from the set if it exists.- Parameters:
value
- the value to remove- Returns:
- true if the set contained the value and it was removed, false otherwise
-
size
public int size()Returns the number of elements currently in the set.- Returns:
- the number of elements in the set
-
iterator
Returns an iterator over the elements in this set. -
clone
Creates and returns a copy of this IntHashSet. -
toString
-