Here you can find the source of readLines(String filename)
public static ArrayList<String> readLines(String filename)
//package com.java2s; //License from project: Apache License import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; public class Main { public static ArrayList<String> readLines(String filename) { File f = new File(filename); if (!f.exists()) { try { f.createNewFile();//w ww . j av a2 s . com } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } try { BufferedReader br = new BufferedReader(new FileReader(filename)); String line; ArrayList<String> lines = new ArrayList<String>(); while ((line = br.readLine()) != null) { lines.add(line); } br.close(); return lines; } catch (IOException localIOException) { localIOException.printStackTrace(); } return null; } }