public static void Main(System.String[] args) { CursorList theList = new CursorList(); CursorListItr theItr; int i; theItr = theList.zeroth(); printList(theList); for (i = 0; i < 10; i++) { theList.insert(new MyInteger(i), theItr); printList(theList); theItr.advance(); } for (i = 0; i < 10; i += 2) { theList.remove(new MyInteger(i)); } for (i = 0; i < 10; i++) { if ((i % 2 == 0) != (theList.find(new MyInteger(i)).PastEnd)) { System.Console.Out.WriteLine("Find fails!"); } } System.Console.Out.WriteLine("Finished deletions"); printList(theList); }
// Simple print method static public void printList(CursorList theList) { if (theList.Empty) { System.Console.Out.Write("Empty list"); } else { CursorListItr itr = theList.first(); for (; !itr.PastEnd; itr.advance()) { //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Object.toString' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'" System.Console.Out.Write(itr.retrieve() + " "); } } System.Console.Out.WriteLine(); }