|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.clapper.util.misc.MultiIterator<T>
public class MultiIterator<T>
The MultiIterator class provides a way to iterate over multiple Collection, Enumeration and Iterator objects at once. You instantiate a MultiIterator object and add one or more Collection, Enumeration or Iterator objects to it; when you use the iterator, it iterates over the contents of each contained composite object, one by one, in the order they were added to the MultiIterator. When the iterator reaches the end of one object's contents, it moves on to the next object, until no more composite objects are left.
Iterator,
Enumeration,
Collection| Constructor Summary | |
|---|---|
MultiIterator()
Allocate a new MultiIterator object. |
|
MultiIterator(java.util.Collection<java.util.Collection<T>> coll)
Allocate a new MultiIterator object that will iterate, in turn, over the contents of each Collection in the supplied Collection |
|
MultiIterator(java.util.Collection<T>[] array)
Allocate a new MultiIterator object that will iterate, in turn, over the contents of each Collection in the supplied array. |
|
| Method Summary | |
|---|---|
void |
addCollection(java.util.Collection<T> collection)
Add a Collection to the end of the list of composite objects being iterated over. |
void |
addEnumeration(java.util.Enumeration<T> enumeration)
Add an Enumeration to the end of the list of composite objects being iterated over. |
void |
addIterator(java.util.Iterator<T> iterator)
Add an Iterator to the end of the list of composite objects being iterated over. |
boolean |
hasNext()
Determine whether the underlying Iterator has more elements. |
java.util.Iterator<T> |
iterator()
Returns this iterator. |
T |
next()
Get the next element from the underlying array. |
void |
remove()
Remove the object most recently extracted from the iterator. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MultiIterator()
public MultiIterator(java.util.Collection<T>[] array)
array - The Collections over which to iterateaddCollection(Collection)public MultiIterator(java.util.Collection<java.util.Collection<T>> coll)
coll - A Collection of Collection objectsaddCollection(Collection)| Method Detail |
|---|
public void addCollection(java.util.Collection<T> collection)
Add a Collection to the end of the list of composite objects being iterated over. It's safe to call this method while iterating, as long as you haven't reached the end of the last composite object currently in the iterator.
Note: This method is simply shorthand for:
addIterator (collection.iterator());
collection - The Collection to add.addIterator(java.util.Iterator) ,
addEnumeration(java.util.Enumeration) public void addIterator(java.util.Iterator<T> iterator)
iterator - The Iterator to add.addCollection(java.util.Collection) ,
addEnumeration(java.util.Enumeration) public void addEnumeration(java.util.Enumeration<T> enumeration)
Note: This method is simply shorthand for:
addIterator (new EnumerationIterator(enumeration));
enumeration - The Enumeration to add.addCollection(java.util.Collection) ,
addIterator(java.util.Iterator) ,
EnumerationIteratorpublic boolean hasNext()
hasNext in interface java.util.Iterator<T>next()public java.util.Iterator<T> iterator()
iterator in interface java.lang.Iterable<T>
public T next()
throws java.util.NoSuchElementException
next in interface java.util.Iterator<T>java.util.NoSuchElementException - No more elements existIterator.next()public void remove()
remove in interface java.util.Iterator<T>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||