Class GrowableIntSet8Bit

java.lang.Object
org.jhotdraw8.collection.primitive.DenseIntSet8Bit
org.jhotdraw8.collection.primitive.GrowableIntSet8Bit
All Implemented Interfaces:
IntSet

public class GrowableIntSet8Bit extends DenseIntSet8Bit
Extension of DenseIntSet8Bit that can be used, when the size of the set is not known.
  • Constructor Details

    • GrowableIntSet8Bit

      public GrowableIntSet8Bit()
  • Method Details

    • addAsInt

      public boolean addAsInt(int element)
      Adds an element to the set.

      Automatically increases the capacity of the set if needed.

      Specified by:
      addAsInt in interface IntSet
      Overrides:
      addAsInt in class DenseIntSet8Bit
      Parameters:
      element - the element
      Returns:
      true if the element was added, false if it was already in the set.
    • removeAsInt

      public boolean removeAsInt(int element)
      Removes the specified element from the set.

      Automatically increases the capacity of the set if needed.

      Specified by:
      removeAsInt in interface IntSet
      Overrides:
      removeAsInt in class DenseIntSet8Bit
      Parameters:
      element - an element
      Returns:
      true if the element was in the set, false otherwise
    • containsAsInt

      public boolean containsAsInt(int element)
      Checks if the set contains the specified element.

      Automatically increases the capacity of the set if needed.

      Specified by:
      containsAsInt in interface IntSet
      Overrides:
      containsAsInt in class DenseIntSet8Bit
      Parameters:
      element - an element
      Returns:
      true if the element is in the set.
      Throws:
      ArrayIndexOutOfBoundsException - if element is outside of the capacity range.