1 package net.sf.saxon.expr; 2 3 import java.util.Iterator ; 4 import java.util.NoSuchElementException ; 5 6 9 public class MonoIterator implements Iterator { 10 11 private Object thing; private boolean gone; 14 public MonoIterator(Object thing) { 15 this.gone = false; 16 this.thing = thing; 17 } 18 19 26 27 public boolean hasNext() { 28 return !gone; 29 } 30 31 37 38 public Object next() { 39 if (gone) { 40 throw new NoSuchElementException (); 41 } else { 42 gone = true; 43 return thing; 44 } 45 } 46 47 59 60 public void remove() { 61 throw new UnsupportedOperationException (); 62 } 63 } 64 65 66 | Popular Tags |