Java tutorial
//package com.java2s; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.List; public class Main { public static List<String> readFileToList(String filepath) { List<String> data = new ArrayList<String>(); try { File file = new File(filepath); FileReader fileReader = new FileReader(file); BufferedReader bufferedReader = new BufferedReader(fileReader); String temp; while ((temp = bufferedReader.readLine()) != null) { data.add(temp); } bufferedReader.close(); } catch (IOException e) { e.printStackTrace(); } return data; } }