Java tutorial
import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.util.ArrayList; import java.util.List; public class Utils { public static List<String> readLines(File file) throws Exception { if (!file.exists()) { return new ArrayList<String>(); } BufferedReader reader = new BufferedReader(new FileReader(file)); List<String> results = new ArrayList<String>(); String line = reader.readLine(); while (line != null) { results.add(line); line = reader.readLine(); } return results; } }