samer@0: package samer.silk; samer@0: import java.util.*; samer@0: import jscheme.*; samer@0: samer@0: public class SchemeList extends AbstractSequentialList { samer@0: SchemePair head; samer@0: samer@0: public SchemeList(SchemePair pair) { head=pair; } samer@0: samer@0: public ListIterator listIterator(int index) { samer@0: return new Iterator(head,index); samer@0: } samer@0: samer@0: public int size() { samer@0: int i=0; samer@0: for (SchemePair p=head; !p.isEmpty(); p=(SchemePair)p.getRest()) i++; samer@0: return i; samer@0: } samer@0: samer@0: class Iterator implements ListIterator { samer@0: SchemePair current, previous=null; samer@0: int index=0; samer@0: samer@0: public Iterator(SchemePair head, int index) { samer@0: current=head; samer@0: for (int i=0; i