Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.2.0)

E17493-03


oracle.ide.util
Class DuplexIterator<T>

java.lang.Object
  extended by oracle.ide.util.DuplexIterator<T>

All Implemented Interfaces:
java.util.Iterator<T>

public class DuplexIterator<T>
extends java.lang.Object
implements java.util.Iterator<T>

The DuplexIterator class iterates contiguously over two other Iterators. Elements from the first Iterator are always returned before elements from the second Iterator. DuplexIterators may be chained to create a multiplexing iterator; for example:

    Iterator triplexIterator(Iterator iter1, Iterator iter2, Iterator iter3)
    {
      return new DuplexIterator(new DuplexIterator(iter1, iter2), iter3);
    }
 

Constructor Summary
DuplexIterator(java.util.Iterator<T> iter1, java.util.Iterator<T> iter2)
          Constructs a DuplexIterator from two other Iterators.

 

Method Summary
 boolean hasNext()
          Returns true if there are more elements in either Iterator; otherwise false.
 T next()
          Returns the next element from the first Iterator; if the first Iterator has no more elements, then returns the next element from the second Iterator.
 void remove()
          Currently unsupported; always throws an UnsupportedOperationException.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

DuplexIterator

public DuplexIterator(java.util.Iterator<T> iter1,
                      java.util.Iterator<T> iter2)
Constructs a DuplexIterator from two other Iterators.
Parameters:
iter1 - the first Iterator over which to iterate
iter2 - the second Iterator over which to iterate

Method Detail

hasNext

public boolean hasNext()
Returns true if there are more elements in either Iterator; otherwise false.
Specified by:
hasNext in interface java.util.Iterator<T>

next

public T next()
Returns the next element from the first Iterator; if the first Iterator has no more elements, then returns the next element from the second Iterator.
Specified by:
next in interface java.util.Iterator<T>
Throws:
java.util.NoSuchElementException - if there are no more elements in either Iterator

remove

public void remove()
Currently unsupported; always throws an UnsupportedOperationException.
Specified by:
remove in interface java.util.Iterator<T>

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.2.0)

E17493-03


Copyright © 1997, 2012, Oracle. All rights reserved.