|
LimeWire Collection Component API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.limewire.collection.DualIterator<T>
public class DualIterator<T>
Provides an iterator that iterates over two other iterators, in order.
LinkedList<String> l1 = new LinkedList<String>();
LinkedList<String> l2 = new LinkedList<String>();
for(int i = 0; i < 5; i++){
l1.add(String.valueOf(i));
l2.add(String.valueOf(i + 10));
}
for(DualIterator<String> di =
new DualIterator<String>(l1.iterator(), l2.iterator()); di.hasNext();)
System.out.println(di.next());
Output:
0
1
2
3
4
10
11
12
13
14
| Constructor Summary | |
|---|---|
DualIterator(Iterator<T> a,
Iterator<T> b)
Constructs a new DualIterator backed by two iterators. |
|
| Method Summary | |
|---|---|
boolean |
hasNext()
Determines if there are any elements left in either iterator. |
T |
next()
Retrieves the next element from the current backing iterator. |
void |
remove()
Removes the element from the current backing iterator. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DualIterator(Iterator<T> a,
Iterator<T> b)
| Method Detail |
|---|
public boolean hasNext()
hasNext in interface Iterator<T>public T next()
next in interface Iterator<T>public void remove()
remove in interface Iterator<T>
|
LimeWire Collection Component API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||