Get List From File
Instantiate a Java List from the contents in a Text file.
Javadoc available at https://www.javatapas.com/docs/javatapas/io/GetListFromFile.html
public static List<String> getListFromFile (String fileName) throws IOException {
List<String> list = new ArrayList<String>();
BufferedReader reader = new BufferedReader(new FileReader(fileName));
String line = reader.readLine();
while (line != null) {
if (!line.startsWith("#")) {list.add(line);}
line = reader.readLine();
}
reader.close();
return list;
}