java.lang.Object | +--org.apache.commons.collections.iterators.CollatingIteratorAll Implemented Interfaces:
Constructs a new CollatingIterator. |
CollatingIterator(final Comparator comp) Constructs a new CollatingIterator that will used the specified comparator for ordering. |
CollatingIterator(final Comparator comp, final int initIterCapacity) Constructs a new CollatingIterator that will used the specified comparator for ordering and have the specified initial capacity. |
CollatingIterator(final Comparator comp, final Iterator a, final Iterator b) Constructs a new CollatingIterator that will use the specified comparator to provide ordered iteration over the two given iterators. |
CollatingIterator(final Comparator comp, final Iterator[] iterators) Constructs a new CollatingIterator that will use the specified comparator to provide ordered iteration over the array of iterators. |
CollatingIterator(final Comparator comp, final Collection iterators) Constructs a new CollatingIterator that will use the specified comparator to provide ordered iteration over the collection of iterators. |
void | addIterator(final Iterator iterator) Adds the given Iterator to the iterators being collated. |
Comparator | Gets the Comparator by which collatation occurs. |
List | Gets the list of Iterators (unmodifiable). |
boolean | hasNext() Returns true if any child iterator has remaining elements. |
Object | next() Returns the next ordered element from a child iterator. |
void | remove() Removes the last returned element from the child iterator that produced it. |
void | setComparator(final Comparator comp) Sets the Comparator by which collation occurs. |
void | setIterator(final int index, final Iterator iterator) Sets the iterator at the given index. |
public CollatingIterator()
CollatingIterator
. Natural sort order
will be used, and child iterators will have to be manually added
using the addIterator(Iterator) method.
public CollatingIterator(final Comparator comp, final Collection iterators)
CollatingIterator
that will use the
specified comparator to provide ordered iteration over the collection
of iterators.
- if the iterators collection is or contains null
- if the iterators collection contains an
element that's not an Iteratorpublic CollatingIterator(final Comparator comp, final int initIterCapacity)
CollatingIterator
that will used the
specified comparator for ordering and have the specified initial
capacity. Child iterators will have to be
manually added using the addIterator(Iterator) method.
public CollatingIterator(final Comparator comp, final Iterator a, final Iterator b)
CollatingIterator
that will use the
specified comparator to provide ordered iteration over the two
given iterators.
- if either iterator is nullpublic CollatingIterator(final Comparator comp, final Iterator[] iterators)
CollatingIterator
that will use the
specified comparator to provide ordered iteration over the array
of iterators.
- if iterators array is or contains nullpublic CollatingIterator(final Comparator comp)
CollatingIterator
that will used the
specified comparator for ordering. Child iterators will have to be
manually added using the addIterator(Iterator) method.
public void addIterator(final Iterator iterator)
- if iteration has started
- if the iterator is nullpublic Comparator getComparator()
public List getIterators()
public boolean hasNext()
true
if any child iterator has remaining elements.
public Object next()
- if no child iterator has any more elementspublic void remove()
- if there is no last returned element,
or if the last returned element has already been removedpublic void setComparator(final Comparator comp)
- if iteration has startedpublic void setIterator(final int index, final Iterator iterator)
- if index < 0 or index > size()
- if iteration has started
- if the iterator is null
A
andB
, the next method on this iterator will return the lesser ofA.next()
andB.next()
.