Class IntGenerator

java.lang.Object
it.unimi.di.prog2.h14.IntGenerator
All Implemented Interfaces:
Iterator<Integer>

public class IntGenerator extends Object implements Iterator<Integer>
Generator (in Liskov parlance) of the ints contained in a List.
  • Field Details

    • els

      private final List<Integer> els
      The list elements.
    • idx

      private int idx
      The position of the next element to return (if idx < els.size().
  • Constructor Details

    • IntGenerator

      public IntGenerator(List<Integer> els)
      Builds an iterator (partial constructor, used just in IntSet).
      Parameters:
      els - the list of elements, must not be, or contain, null.
  • Method Details