Here you can find the source of readFileToList(File file)
public static List<String> readFileToList(File file)
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Main { public static List<String> readFileToList(File file) { ArrayList<String> list = new ArrayList<>(); try {/*w w w . j a v a2 s.c om*/ Scanner scan = new Scanner(file); while (scan.hasNextLine()) { list.add(scan.nextLine()); } } catch (FileNotFoundException ex) { return null; } return list; } }