package conditional; class IteratorImpl { RunningList state; public boolean hasNext() { return (this.state != null); } public RunningList next() { RunningList obj = this.state; this.state = this.state.next; return obj; } public IteratorImpl (RunningList l) { state = l; } } public class RunningList { int data; RunningList next; public static void m(IteratorImpl y, int[ ] a,int[ ] b) { while (y.hasNext()){ RunningList o = y.next(); int i= o.data, j = i; while(a[i] > 0) { a[i]--; b[j]++; } } } }