Here you can find the source of loadLineByLineAndTrim(String file_path)
public static List<String> loadLineByLineAndTrim(String file_path)
//package com.java2s; //License from project: Apache License import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.util.ArrayList; import java.util.List; public class Main { public static List<String> loadLineByLineAndTrim(String file_path) { List<String> lines = new ArrayList<String>(); try {/*ww w . ja v a 2 s . c o m*/ File f = new File(file_path); if (!f.exists()) return lines; BufferedReader br1 = new BufferedReader(new FileReader(f)); while (br1.ready()) { String line = br1.readLine(); lines.add(line.trim()); } br1.close(); } catch (Exception e) { e.printStackTrace(); } return lines; } }