From 07fd75f2c7907775f0edd1a08bd18021e896a8da Mon Sep 17 00:00:00 2001 From: amontano Date: Sun, 6 Mar 2005 10:03:39 +0000 Subject: [PATCH] Added a method to write the list into a file. Useful for debugging. --- source/org/thdl/util/SimplifiedLinkedList.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/source/org/thdl/util/SimplifiedLinkedList.java b/source/org/thdl/util/SimplifiedLinkedList.java index 7a302c0..44f939d 100644 --- a/source/org/thdl/util/SimplifiedLinkedList.java +++ b/source/org/thdl/util/SimplifiedLinkedList.java @@ -17,7 +17,8 @@ Contributor(s): ______________________________________. */ package org.thdl.util; -import java.util.*; + +import java.io.*; /** 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 @@ -195,5 +196,12 @@ public class SimplifiedLinkedList else array[n] = o.toString(); } return array; - } + } + + public void write(PrintWriter pw) + { + SimplifiedListIterator li = listIterator(); + while (li.hasNext()) + pw.println(li.next()); + } }