Here you can find the source of readFileAsLines(String aFile)
public static List<String> readFileAsLines(String aFile) throws IOException
//package com.java2s; //License from project: Apache License import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.List; import java.util.Vector; public class Main { public static List<String> readFileAsLines(String aFile) throws IOException { BufferedReader input = new BufferedReader(new FileReader(aFile)); List<String> lines = new Vector<String>(); try {// w w w . java 2 s . c o m String line = null; //not declared within while loop /* * readLine is a bit quirky : * it returns the content of a line MINUS the newline. * it returns null only for the END of the stream. * it returns an empty String if two newlines appear in a row. */ while ((line = input.readLine()) != null) { lines.add(line); } } finally { input.close(); } return lines; } }