read a file into List
There are many ways to read file into a List in Java.
Scanner s = new Scanner(new File("filepath")); ArrayList<String> list = new ArrayList<String>(); while (s.hasNext()){ list.add(s.next()); } s.close();
List<String> lines = FileUtils.readLines(new File("input.txt"), "utf-8");
List<String> lines = Files.readLines(new File("input.txt"), Charset.forName("utf-8"));
Java 7.0
List<String> list = Files.readAllLines(new File("input.txt").toPath(), Charset.defaultCharset() );