Class ListBasedAbstractIntSet

java.lang.Object
it.unimi.di.prog2.h18.refactored.AbstractIntSet
it.unimi.di.prog2.h18.refactored.ListBasedAbstractIntSet
All Implemented Interfaces:
Iterable<Integer>
Direct Known Subclasses:
IntSet, OrderedIntSet

public abstract class ListBasedAbstractIntSet extends AbstractIntSet
An partial implementation of AbstractIntSet based on List.
  • Field Details

    • elements

      protected final List<Integer> elements
      The set elements.
  • Constructor Details

    • ListBasedAbstractIntSet

      public ListBasedAbstractIntSet()
      Creates an empty set.
  • Method Details

    • iterator

      public Iterator<Integer> iterator()
    • remove

      public void remove(int x)
      Description copied from class: AbstractIntSet
      Removes the given element from this set.

      This method modifies the object, that is: \( S' = S \setminus \{ x \} \).

      Specified by:
      remove in class AbstractIntSet
      Parameters:
      x - the element to be removed.