private Set<String> loadFile(String fileName) throws IOException {
  Set<String> container=new HashSet<String>();
  FileInputStream fstream=null;
  DataInputStream in=null;
  BufferedReader br=null;
  try {
    fstream=new FileInputStream(fileName);
    in=new DataInputStream(fstream);
    br=new BufferedReader(new InputStreamReader(in));
    String strLine;
    while ((strLine=br.readLine()) != null) {
      container.add(strLine);
    }
  }
  finally {
    if (br != null) {
      br.close();
    }
    if (in != null) {
      in.close();
    }
    if (fstream != null) {
      fstream.close();
    }
  }
  return container;
}

private Set < String > loadFile ( String fileName ) throws IOException { Set < String > container = new HashSet < String > ( ) ; FileInputStream fstream = null ; DataInputStream in = null ; BufferedReader br = null ; try { fstream = new FileInputStream ( fileName ) ; in = new DataInputStream ( fstream ) ; br = new BufferedReader ( new InputStreamReader ( in ) ) ; String strLine ; while ( ( strLine = br . readLine ( ) ) != null ) { container . add ( strLine ) ; } } finally { if ( br != null ) { br . close ( ) ; } if ( in != null ) { in . close ( ) ; } if ( fstream != null ) { fstream . close ( ) ; } } return container ; }
loads a text file line - by - line into a set of strings .
