Package ghidra.util.datastruct
Class IntSet
java.lang.Object
ghidra.util.datastruct.IntSet
Class for storing a set of integers
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(int value) Add the int value to the set.void
clear()
Removes all values from the set.boolean
contains
(int value) Returns true if the set contains the given value.int[]
Returns an array with all the values in the set.boolean
isEmpty()
Returns true if the set is emptyboolean
remove
(int value) Removes the int value from the set.int
size()
Returns the number of ints in the set.
-
Constructor Details
-
IntSet
public IntSet(int capacity) Constructs a new empty int set- Parameters:
capacity
- the initial storage size, the set will grow if needed.
-
IntSet
public IntSet(int[] values) Constructs a new IntSet and populates it with the given array of ints.- Parameters:
values
- the array if ints to add to the set.
-
-
Method Details
-
size
public int size()Returns the number of ints in the set.- Returns:
- the number of ints in the set.
-
isEmpty
public boolean isEmpty()Returns true if the set is empty -
contains
public boolean contains(int value) Returns true if the set contains the given value.- Parameters:
value
- the value to test if it is in the set.- Returns:
- true if the value is in the set.
-
add
public void add(int value) Add the int value to the set.- Parameters:
value
- the value to add to the set.
-
remove
public boolean remove(int value) Removes the int value from the set.- Parameters:
value
- the value to remove from the set.- Returns:
- true if the value was in the set, false otherwise.
-
clear
public void clear()Removes all values from the set. -
getValues
public int[] getValues()Returns an array with all the values in the set.
-