Added a method to write the list into a file. Useful for debugging.
This commit is contained in:
parent
063e04b7c4
commit
07fd75f2c7
1 changed files with 10 additions and 2 deletions
|
@ -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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue