Module org.hsqldb

Class WrapperIterator<E>

java.lang.Object
org.hsqldb.lib.WrapperIterator<E>
All Implemented Interfaces:
Iterator<E>

public class WrapperIterator<E> extends Object implements Iterator<E>
An Iterator that returns the elements of a specified array, or other iterators etc. The collection of objects returned depends on the constructor used.

Based on similar Enumerator code by campbell-burnet@users

Since:
HSQLDB 1.7.2
Author:
fred@users
  • Constructor Details

    • WrapperIterator

      public WrapperIterator()
      Constructor for an empty iterator.
    • WrapperIterator

      public WrapperIterator(Object[] elements)
      Constructor for all elements of the specified array.
      Parameters:
      elements - the array of objects to enumerate
    • WrapperIterator

      public WrapperIterator(Object[] elements, boolean notNull)
      Constructor for not-null elements of specified array.
      Parameters:
      elements - the array of objects to iterate
      notNull - boolean
    • WrapperIterator

      public WrapperIterator(Object element)
      Constructor for a singleton object iterator
      Parameters:
      element - the single object to iterate
    • WrapperIterator

      public WrapperIterator(Iterator<E> it1, Iterator<E> it2)
      Constructor for a chained iterator that returns the elements of the two specified iterators.
      Parameters:
      it1 - Iterator
      it2 - Iterator
  • Method Details

    • hasNext

      public boolean hasNext()
      Tests if this iterator contains more elements.

      Specified by:
      hasNext in interface Iterator<E>
      Returns:
      true if this iterator contains more elements; false otherwise.
    • next

      public E next()
      Returns the next element.
      Specified by:
      next in interface Iterator<E>
      Returns:
      the next element
      Throws:
      NoSuchElementException - if there is no next element
    • nextInt

      public int nextInt()
      Specified by:
      nextInt in interface Iterator<E>
    • nextLong

      public long nextLong()
      Specified by:
      nextLong in interface Iterator<E>
    • remove

      public void remove()
      Specified by:
      remove in interface Iterator<E>