Here you can find the source of readLines(String filePath)
public static List<String> readLines(String filePath)
//package com.java2s; //License from project: Apache License import java.io.*; import java.util.ArrayList; import java.util.List; public class Main { public static List<String> readLines(String filePath) { try {//from ww w . j av a2 s . c o m FileReader fr = new FileReader(filePath); BufferedReader br = new BufferedReader(fr); List<String> res = new ArrayList<>(); String buf; while ((buf = br.readLine()) != null) { res.add(buf); } br.close(); fr.close(); return res; } catch (IOException e) { e.printStackTrace(); } return null; } }