2.17.2: 2011-06-17

net.sf.basedb.util
Class NestedIterator<E>

java.lang.Object
  extended by net.sf.basedb.util.NestedIterator<E>
All Implemented Interfaces:
Iterator<E>

public class NestedIterator<E>
extends Object
implements Iterator<E>

This class implements the Iterator interface for iterating multiple collections as if it was one big collection.

Version:
2.0
Author:
Nicklas
Last modified
$Date: 2008-09-11 22:08:14 +0200 (Thu, 11 Sep 2008) $

Field Summary
private  Collection<? extends E>[] collections
          The array to iterate.
private  Iterator<? extends E> current
          The current iterator.
private  int index
          The index of the next collection to return.
 
Constructor Summary
NestedIterator(Collection<? extends E>... collections)
          Create a new ArrayIterator object.
 
Method Summary
 boolean hasNext()
           
 E next()
           
 void remove()
          This operation is not supported.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

collections

private final Collection<? extends E>[] collections
The array to iterate.


index

private int index
The index of the next collection to return.


current

private Iterator<? extends E> current
The current iterator.

Constructor Detail

NestedIterator

public NestedIterator(Collection<? extends E>... collections)
Create a new ArrayIterator object.

Parameters:
collections - An array of Collection objects.
Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator<E>

next

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

remove

public void remove()
This operation is not supported.

Specified by:
remove in interface Iterator<E>
Throws:
UnsupportedOperationException - Is always thrown

2.17.2: 2011-06-17