1 6 7 package com.hp.hpl.jena.util.iterator; 8 9 20 abstract public class LazyIterator implements ExtendedIterator { 21 22 private ExtendedIterator it=null; 23 24 28 public LazyIterator() { 29 } 30 31 public boolean hasNext() { 32 lazy(); 33 return it.hasNext(); 34 } 35 36 public Object next() { 37 lazy(); 38 return it.next(); 39 } 40 41 public void remove() { 42 lazy(); 43 it.remove(); 44 } 45 46 public ExtendedIterator andThen(ClosableIterator other) { 47 lazy(); 48 return it.andThen(other); 49 } 50 51 public ExtendedIterator filterKeep(Filter f) { 52 lazy(); 53 return it.filterKeep(f); 54 } 55 56 public ExtendedIterator filterDrop(Filter f) { 57 lazy(); 58 return it.filterDrop(f); 59 } 60 61 public ExtendedIterator mapWith(Map1 map1) { 62 lazy(); 63 return it.mapWith(map1); 64 } 65 66 public void close() { 67 lazy(); 68 it.close(); 69 70 } 71 72 private void lazy() { 73 if (it == null) 74 it = create(); 75 } 76 77 85 public abstract ExtendedIterator create(); 86 87 } 88 89 118 | Popular Tags |