Module org.hsqldb

Class WrapperIterator<E>

  • All Implemented Interfaces:
    Iterator<E>

    public class WrapperIterator<E>
    extends java.lang.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 Toussi (fredt@users dot sourceforge.net)
    • Constructor Summary

      Constructors 
      Constructor Description
      WrapperIterator()
      Constructor for an empty iterator.
      WrapperIterator​(java.lang.Object element)
      Constructor for a singleton object iterator
      WrapperIterator​(java.lang.Object[] elements)
      Constructor for all elements of the specified array.
      WrapperIterator​(java.lang.Object[] elements, boolean notNull)
      Constructor for not-null elements of specified array.
      WrapperIterator​(Iterator<E> it1, Iterator<E> it2)
      Constructor for a chained iterator that returns the elements of the two specified iterators.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean hasNext()
      Tests if this iterator contains more elements.
      E next()
      Returns the next element.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • WrapperIterator

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

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

        public WrapperIterator​(java.lang.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​(java.lang.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 Detail

      • 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:
        java.util.NoSuchElementException - if there is no next element