Added a method to write the list into a file. Useful for debugging.

This commit is contained in:
amontano 2005-03-06 10:03:39 +00:00
parent 063e04b7c4
commit 07fd75f2c7

View file

@ -17,7 +17,8 @@ Contributor(s): ______________________________________.
*/ */
package org.thdl.util; package org.thdl.util;
import java.util.*;
import java.io.*;
/** Implementation of a simple dynamic link list. Be careful with word order! /** Implementation of a simple dynamic link list. Be careful with word order!
Why not just use java.util.LinkedList? It is not supported for the Why not just use java.util.LinkedList? It is not supported for the
@ -195,5 +196,12 @@ public class SimplifiedLinkedList
else array[n] = o.toString(); else array[n] = o.toString();
} }
return array; return array;
} }
public void write(PrintWriter pw)
{
SimplifiedListIterator li = listIterator();
while (li.hasNext())
pw.println(li.next());
}
} }