Here you can find the source of readFileAsListOfString(String fileName, String splitBy)
public static List<String> readFileAsListOfString(String fileName, String splitBy) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.util.*; public class Main { public static List<String> readFileAsListOfString(String fileName, String splitBy) throws IOException { File file = new File(fileName); BufferedReader buffer = new BufferedReader(new FileReader(file)); String line;/* w ww .java2 s . c o m*/ List<String> data = new ArrayList<>(); while ((line = buffer.readLine()) != null) { data = Arrays.asList(line.split(splitBy)); } return data; } }