package org.cloudbus.cloudsim.codes.test.file;

import com.opencsv.CSVWriter;
import org.apache.commons.io.FileUtils;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import java.net.FileNameMap;
import java.util.ArrayList;
import java.util.List;

/**
 * ClassName CSVWrittingExample
 * Description
 * Create by HW
 * Date 2021/11/24 18:02
 */
public class CSVWrittingExample {
    //文件的写入
    public static void main(String[] args) {
        try {
            String file="E:\\研究生\\研究生\\论文\\cloudsim学习文档\\cloudsim-5 (2).0\\csvtest.csv";
            File filename= new File(file);
            List<Integer> list=new ArrayList();
            for (int i = 0; i < 10; i++) {
                list.add(i);
            }
            FileUtils.writeLines(filename,list);

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
