1 package net.sf.saxon.expr; 2 3 import java.util.Iterator ; 4 5 8 public class MultiIterator implements Iterator { 9 10 private Iterator [] array; 11 private int current; 12 13 public MultiIterator(Iterator [] array) { 14 this.array = array; 15 this.current = 0; 16 } 17 18 25 26 public boolean hasNext() { 27 while (true) { 28 if (current >= array.length) { 29 return false; 30 } 31 if (array[current].hasNext()) { 32 return true; 33 } 34 current++; 35 } 36 } 37 38 44 public Object next() { 45 return array[current].next(); 46 } 47 48 64 public void remove() { 65 throw new UnsupportedOperationException (); 66 } 67 } 68 69 70 | Popular Tags |