Here you can find the source of fileToLines(File file)
static List<String> fileToLines(File file)
//package com.java2s; // it under the terms of the GNU General Public License as published by import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.util.LinkedList; import java.util.List; public class Main { static List<String> fileToLines(File file) { List<String> lines = new LinkedList<String>(); String line = ""; try {/*from w w w.jav a 2s . co m*/ BufferedReader in = new BufferedReader(new FileReader(file)); while ((line = in.readLine()) != null) { lines.add(line); } in.close(); } catch (IOException e) { e.printStackTrace(); } return lines; } static List<String> fileToLines(String filename) { List<String> lines = new LinkedList<String>(); String line = ""; try { BufferedReader in = new BufferedReader(new FileReader(filename)); while ((line = in.readLine()) != null) { lines.add(line); } in.close(); } catch (IOException e) { e.printStackTrace(); } return lines; } }