| | |
Write Lists to Text File
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
I couldn't speak to Groovy, but it's fairly straightforward to write a List to a file
java Syntax (Toggle Plain Text)
try { List<String> someList = new ArrayList<String>(); // obviously you would want to use a list with stuff in it BufferedWriter out = new BufferedWriter( new FileWriter("outfilename")); for (String item : someList){ out.write(item); out.newLine(); } out.flush(); out.close(); } catch (IOException e) { e.printStackTrace(); }
![]() |
Similar Threads
- Help reading/writing to text files... (C++)
- New programming language: Who can figure it out? (Computer Science)
- Characters to Lists (Python)
- Text (Shell Scripting)
- Source Code that don't work? (Java)
- please help! (C++)
- help with writing CGI!! (Perl)
- please help me (C++)
Other Threads in the Java Forum
- Previous Thread: 2d arrayist
- Next Thread: Returning string from method help
| Thread Tools | Search this Thread |
android api applet application array arrays automation awt bidirectional binary birt bluetooth businessintelligence busy_handler(null) chat class classes client code columns component constructor database designadrawingapplicationusingjavajslider draw eclipse editor error errors event eventlistener exception expand fractal game givemetehcodez graphics gui guidancer html ide image inetaddress input integer intellij j2me java javafx javamicroeditionuseofmotionsensor javaprojects jme jni jpanel jtree julia linux list loop map method methods mobile mobiledevelopmentcreatejar myaggfun netbeans newbie oracle parsing plazmic print problem program programming project recursion scanner screen server set sharepoint size smart sms smsspam sort sortedmaps sql string subclass support swing textfield threads time tree unlimited utility webservices windows






