net.sf.jga.algorithms
Class Merge.MergeIterator<T>
java.lang.Object
net.sf.jga.algorithms.Merge.MergeIterator<T>
- All Implemented Interfaces:
- java.util.Iterator<T>
- Enclosing class:
- Merge
public static class Merge.MergeIterator<T>
- extends java.lang.Object
- implements java.util.Iterator<T>
Iterator that merges the contents of two input iterators.
Constructor Summary |
Merge.MergeIterator(java.util.Iterator<? extends T> base1,
java.util.Iterator<? extends T> base2,
BinaryFunctor<T,T,java.lang.Boolean> pred)
Builds a Merge.Iterator for the given base iterators that uses the given
predicate to compare corresponding elements. |
Merge.MergeIterator(java.util.Iterator<? extends T> base1,
java.util.Iterator<? extends T> base2,
java.util.Comparator<T> comp)
Builds a Merge.Iterator for the given base iterators that uses the given
Comparator to compare corresponding elements. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Merge.MergeIterator
public Merge.MergeIterator(java.util.Iterator<? extends T> base1,
java.util.Iterator<? extends T> base2,
java.util.Comparator<T> comp)
- Builds a Merge.Iterator for the given base iterators that uses the given
Comparator to compare corresponding elements. The Comparator will be
used with a LessEqualComp predicate.
- Throws:
java.lang.IllegalArgumentException
- if either argument is null
Merge.MergeIterator
public Merge.MergeIterator(java.util.Iterator<? extends T> base1,
java.util.Iterator<? extends T> base2,
BinaryFunctor<T,T,java.lang.Boolean> pred)
- Builds a Merge.Iterator for the given base iterators that uses the given
predicate to compare corresponding elements. The predicate should return
TRUE if its first argument is less than or equal to the second.
- Throws:
java.lang.IllegalArgumentException
- if either argument is null
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interface java.util.Iterator<T>
next
public T next()
- Specified by:
next
in interface java.util.Iterator<T>
remove
public void remove()
- Specified by:
remove
in interface java.util.Iterator<T>
Copyright © 2002-2006 David A. Hall. All Rights Reserved.