Class IntSet

java.lang.Object
ghidra.util.datastruct.IntSet

public class IntSet extends Object
Class for storing a set of integers
  • Constructor Summary

    Constructors
    Constructor
    Description
    IntSet(int capacity)
    Constructs a new empty int set
    IntSet(int[] values)
    Constructs a new IntSet and populates it with the given array of ints.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(int value)
    Add the int value to the set.
    void
    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
    Returns true if the set is empty
    boolean
    remove(int value)
    Removes the int value from the set.
    int
    Returns the number of ints in the set.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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.