org.hsqldb.lib
Class WrapperIterator

java.lang.Object
  extended byorg.hsqldb.lib.WrapperIterator
All Implemented Interfaces:
Iterator

public class WrapperIterator
extends Object
implements Iterator

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 boucherb@users

Since:
HSQLDB 1.7.2
Version:
1.7.2
Author:
fred@users

Constructor Summary
WrapperIterator()
          Constructor for an empty iterator.
WrapperIterator(Iterator it1, Iterator it2)
          Constructor for a chained iterator that retuns the elements of the two specified iterators.
WrapperIterator(Object element)
          Constructor for a singleton object iterator
WrapperIterator(Object[] elements)
          Constructor for all elements of the specified array.
WrapperIterator(Object[] elements, boolean notNull)
          Constructor for not-null elements of specified array.
 
Method Summary
 boolean hasNext()
          Tests if this iterator contains more elements.
 Object next()
          Returns the next element.
 int nextInt()
           
 long nextLong()
           
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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

WrapperIterator

public WrapperIterator(Object element)
Constructor for a singleton object iterator

Parameters:
element - the single object to iterate

WrapperIterator

public WrapperIterator(Iterator it1,
                       Iterator it2)
Constructor for a chained iterator that retuns the elements of the two specified iterators.

Method Detail

hasNext

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

Specified by:
hasNext in interface Iterator
Returns:
true if this iterator contains more elements; false otherwise.

next

public Object next()
Returns the next element.

Specified by:
next in interface Iterator
Returns:
the next element
Throws:
NoSuchElementException - if there is no next element

nextInt

public int nextInt()
Specified by:
nextInt in interface Iterator

nextLong

public long nextLong()
Specified by:
nextLong in interface Iterator

remove

public void remove()
Specified by:
remove in interface Iterator


Copyright © 2001 - 2004 HSQL Development Group. All Rights Reserved.