Class Combinations.SingletonIterator

java.lang.Object
org.apache.commons.math3.util.Combinations.SingletonIterator
All Implemented Interfaces:
Iterator<int[]>
Enclosing class:
Combinations

private static class Combinations.SingletonIterator extends Object implements Iterator<int[]>
Iterator with just one element to handle degenerate cases (full array, empty array) for combination iterator.
  • Field Details

    • singleton

      private final int[] singleton
      Singleton array
    • more

      private boolean more
      True on initialization, false after first call to next
  • Constructor Details

    • SingletonIterator

      SingletonIterator(int[] singleton)
      Create a singleton iterator providing the given array.
      Parameters:
      singleton - array returned by the iterator
  • Method Details

    • hasNext

      public boolean hasNext()
      Specified by:
      hasNext in interface Iterator<int[]>
      Returns:
      True until next is called the first time, then false
    • next

      public int[] next()
      Specified by:
      next in interface Iterator<int[]>
      Returns:
      the singleton in first activation; throws NSEE thereafter
    • remove

      public void remove()
      Not supported
      Specified by:
      remove in interface Iterator<int[]>