Java FileWriter Write saveList(String listName, Set list)

Here you can find the source of saveList(String listName, Set list)

Description

save List

License

Open Source License

Declaration

public static void saveList(String listName, Set<String> list)
            throws FileNotFoundException, IOException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;

import java.io.FileWriter;
import java.io.IOException;

import java.util.Set;

public class Main {
    public static void saveList(String listName, Set<String> list)
            throws FileNotFoundException, IOException {
        try (BufferedWriter bw = new BufferedWriter(new FileWriter(
                new File(listName)))) {
            for (String line : list) {
                bw.write(line);/* ww w .  ja  v a 2 s  . com*/
                bw.write("\n");
            }
        }
    }
}

Related

  1. saveGraph(List> graph, String sFileName)
  2. saveIndex(File root_, Hashtable index)
  3. saveInputStreamInFile(InputStream stream, FileWriter f)
  4. saveIntegerNodes2File(Integer[] nodes, String fileName)
  5. saveIntNodes2File(int[] nodes, String fileName)
  6. saveListStringToFile(String filePath, List listString)
  7. saveListToFile(ArrayList list, String filePath)
  8. saveMap(Map map, String filePath)
  9. saveMap(String filename, Map map)