public static ArrayList inputText(String sourceFileName){
ArrayList lines = new ArrayList<>();
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader(sourceFileName));
String strLine = null;
while ((strLine = br.readLine()) != null){
strLine = strLine.trim();
lines.add(strLine);
}
} catch (IOException e) {
e.printStackTrace();
} finally {
if (br != null){
try {
br.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return lines;
}
@org.junit.Test
public void test3() {
ArrayList<String> list =
TextDispose.inputText("file1.txt");
for (String s : list){
if (s != ""){
System.out.println("--"+s+"--");
}
}
}