package StringList public class StringList String first String last construct() first = null last = null function add(string s) String news = new String(s) if last == null first = news last = news news.next = null news.prev = null else last.next = news news.prev = last last = news function remove(string s) String curr = first while curr != null if curr.content == s if curr == last last = curr.prev if curr == first first = curr.next destroy curr break curr = curr.next function iterator() returns StringIteratorC return new StringIteratorC(first) ondestroy String curr = first while curr != null destroy curr curr = curr.next class String string content String next String prev construct(string s) content = s ondestroy if next != null next.prev = prev if prev != null prev.next = next public class StringIteratorC String pos construct(String first) pos = first function hasNext() returns boolean return pos != null function next() returns string String buf = pos pos = pos.next return buf.content function close()