Hi guys, I have this arraylist I want to write to a file. The arrayList is being populated by a file that i am reading in. This arrayList then goes through some loops and specific indexes within the arraylist are changed. When I go to write the arraylist to a file:
FileOutputStream out = new FileOutputStream("1.txt"); PrintStream p = new PrintStream(out); pw = new PrintWriter(out, true);
The incorrect information is written. The content written is the exact same content as was read in from the file minus the changes. When i stepped through my code using netbeans, I saw that infact the arrayList that I wrote the the file had the necessary changes in it. When I do a system.out.println of the arraylist, the changes so up. Its when i try and write the ArrayList to the file,that it doesnt print the changes. What could be wrong?
here is my code:
tempSettings is the arrayList that is getting populated by the file that i am reading in. myListTest is the list that I am setting up to write to the file(populated by tempSettings). Where am i going wrong? Any help would be appreciated. Thanks
[ July 25, 2005: Message edited by: Nick Patel ] [ July 25, 2005: Message edited by: Nick Patel ]
I was told by someone here at work, That i might want to add the arrayList to a List and that that might fix my problem. Basically it doesnt do anything other than add more code to my program. The System.out.println(tempSettings) prints exactley what i want it to.