Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.jdaemon.util.iterator
Class CompoundIterator  view CompoundIterator download CompoundIterator.java

java.lang.Object
  extended byorg.jdaemon.util.iterator.CompoundIterator
All Implemented Interfaces:
java.util.Iterator

public class CompoundIterator
extends java.lang.Object
implements java.util.Iterator

Takes two iterators and turns them into a single iterator Elements in the enumeration A will be returned until there are none left; After that, elements in the enumeration B will be returned.

Version:

Field Summary
private  java.util.Iterator a
          Iterator A
private  java.util.Iterator b
          Iterator B
 
Constructor Summary
CompoundIterator(java.util.Iterator a, java.util.Iterator b)
          Creates new CompoundIterator
 
Method Summary
 boolean hasNext()
          Test for more elements true if more elements exist in either iterator A or B
 java.lang.Object next()
          Obtain the next element in the collection.
 void remove()
          Remove from the underlying collection the last element returned by next (optional operation).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

a

private java.util.Iterator a
Iterator A


b

private java.util.Iterator b
Iterator B

Constructor Detail

CompoundIterator

public CompoundIterator(java.util.Iterator a,
                        java.util.Iterator b)
Creates new CompoundIterator

Method Detail

hasNext

public boolean hasNext()
Test for more elements true if more elements exist in either iterator A or B

Specified by:
hasNext in interface java.util.Iterator

next

public java.lang.Object next()
Description copied from interface: java.util.Iterator
Obtain the next element in the collection.

Specified by:
next in interface java.util.Iterator

remove

public void remove()
Description copied from interface: java.util.Iterator
Remove from the underlying collection the last element returned by next (optional operation). This method can be called only once after each call to next(). It does not affect what will be returned by subsequent calls to next.

Specified by:
remove in interface java.util.Iterator