Here you can find the source of readFileByLines(String filePath)
public static List<String> readFileByLines(String filePath)
//package com.java2s; //License from project: Apache License import java.io.File; import java.io.IOException; import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Path; import java.util.List; public class Main { public static List<String> readFileByLines(String filePath) { Path path = new File(filePath).toPath(); return readFileByLines(path); }//ww w. j ava 2 s . c o m public static List<String> readFileByLines(File file) { return readFileByLines(file.toPath()); } private static List<String> readFileByLines(Path path) { List<String> lines = null; try { lines = Files.readAllLines(path, Charset.defaultCharset()); } catch (IOException e) { e.printStackTrace(); } return lines; } }