Here you can find the source of loadList(final File file)
public static HashSet<String> loadList(final File file)
//package com.java2s; // it under the terms of the GNU General Public License as published by import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashSet; public class Main { public static HashSet<String> loadList(final File file) { final HashSet<String> set = new HashSet<String>(); BufferedReader br = null; try {/*from www . ja v a2 s .co m*/ br = new BufferedReader(new InputStreamReader(new FileInputStream(file))); String line; while ((line = br.readLine()) != null) { line = line.trim(); if (line.length() > 0 && line.charAt(0) != '#') { set.add(line.trim().toLowerCase()); } } br.close(); } catch (final IOException e) { } finally { if (br != null) { try { br.close(); } catch (final Exception e) { } } } return set; } }