Orbital library

orbital.util
Class SequenceIterator

java.lang.Object
  extended by orbital.util.SequenceIterator
All Implemented Interfaces:
java.io.Serializable, java.util.Iterator

public class SequenceIterator
extends java.lang.Object
implements java.util.Iterator, java.io.Serializable

A SequenceIterator represents the logical concatenation of other iterators. It starts out with a list of iterators and reads from the first one until the end is reached, whereupon it reads from the second one, and so on, until the end is reached on the last of the contained iterators.

Author:
André Platzer
See Also:
SequenceInputStream, Serialized Form
Invariants:
current ∈ iterators && (!hasNext() xor next() ∈ RES(current))

Constructor Summary
SequenceIterator(java.util.Iterator iterators)
          Create a new sequence iterator over an iterator of iterators.
SequenceIterator(java.util.Iterator[] iterators)
          Create a new sequence iterator over an array of iterators.
SequenceIterator(java.util.List iterators)
          Create a new sequence iterator over a list of iterators.
 
Method Summary
 boolean hasNext()
           
 java.lang.Object next()
           
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SequenceIterator

public SequenceIterator(java.util.Iterator iterators)
Create a new sequence iterator over an iterator of iterators.

Parameters:
iterators - is an iterator over iterators whose elements this SequenceIterator will provide, one after one.

SequenceIterator

public SequenceIterator(java.util.List iterators)
Create a new sequence iterator over a list of iterators.

Note that modifying iterators will result in a ConcurrentModificationException at runtime, as per general contract of list iterators.

Parameters:
iterators - is a list of iterators whose elements this SequenceIterator will provide, one after one.

SequenceIterator

public SequenceIterator(java.util.Iterator[] iterators)
Create a new sequence iterator over an array of iterators.

Parameters:
iterators - is an array of iterators whose elements this SequenceIterator will provide, one after one.
Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface java.util.Iterator

next

public java.lang.Object next()
Specified by:
next in interface java.util.Iterator

remove

public void remove()
Specified by:
remove in interface java.util.Iterator

Orbital library
1.3.0: 11 Apr 2009

Copyright © 1996-2009 André Platzer
All Rights Reserved.