Interface IntSet

All Known Implementing Classes:
BitIntSet, ListIntSet

public interface IntSet
A set of integers
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(int value)
    Adds an int to a set
    int
    Returns the count of unique elements in this set.
    boolean
    has(int value)
    Checks to see if a value is in the set
    Iterates the set
    void
    merge(IntSet other)
    Merges other into this set, so this set becomes the union of the two.
    void
    remove(int value)
    Removes an int from a set.
  • Method Details

    • add

      void add(int value)
      Adds an int to a set
      Parameters:
      value - int to add
    • remove

      void remove(int value)
      Removes an int from a set.
      Parameters:
      value - int to remove
    • has

      boolean has(int value)
      Checks to see if a value is in the set
      Parameters:
      value - int to check
      Returns:
      true if in set
    • merge

      void merge(IntSet other)
      Merges other into this set, so this set becomes the union of the two.
      Parameters:
      other - non-null; other set to merge with.
    • elements

      int elements()
      Returns the count of unique elements in this set.
      Returns:
      > = 0; count of unique elements
    • iterator

      IntIterator iterator()
      Iterates the set
      Returns:
      non-null; a set iterator