Here you can find the source of fileToListByLine(String fileName)
public static List<String> fileToListByLine(String fileName) throws Exception
//package com.java2s; import java.io.BufferedReader; import java.io.FileReader; import java.util.LinkedList; import java.util.List; public class Main { public static List<String> fileToListByLine(String fileName) throws Exception { List<String> lineList = new LinkedList<String>(); String line = ""; BufferedReader in = null; try {/* w ww . ja v a2 s . co m*/ in = new BufferedReader(new FileReader(fileName)); while ((line = in.readLine()) != null) { lineList.add(line); } } catch (Exception e) { throw e; } finally { if (null != in) { in.close(); } } return lineList; } }