Class IntGenerator

java.lang.Object
it.unimi.di.prog2.h13.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 int[] els
      The list elements.
    • size

      private final int size
      The number of elements in the set.
    • idx

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

    • IntGenerator

      public IntGenerator(int[] els, int size)
      Builds an iterator (partial constructor, used just in ArrayIntSet).
      Parameters:
      els - the list of elements, must not be, or contain, null.
      size - the number of set elements in els.
  • Method Details