Here you can find the source of readFile(String file)
public static List<String> readFile(String file)
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.List; public class Main { public static List<String> readFile(String file) { List<String> lines = new ArrayList<String>(); File emailsFile = new File(file); try {/* w ww .j av a 2 s .c om*/ FileReader fread = new FileReader(emailsFile); BufferedReader buffReader = new BufferedReader(fread); String line = " "; while ((line = buffReader.readLine()) != null) { lines.add(line); } buffReader.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return lines; } }