Skip to content

Instantly share code, notes, and snippets.

@bragboy
Created June 24, 2016 13:04
Show Gist options
  • Save bragboy/cd50cda0636d6a4dc748b393e7e7388c to your computer and use it in GitHub Desktop.
Save bragboy/cd50cda0636d6a4dc748b393e7e7388c to your computer and use it in GitHub Desktop.
package dsa.tries;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
public class TrieLoader {
public static Trie trieDSA;
public static void main(String[] args) {
TrieLoader trieLoader = new TrieLoader();
trieLoader.load();
new TrieTestFrame();
}
public void load(){
trieDSA = new Trie();
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader(new File("src/properties/words.txt")));
String eachLine = null;
while((eachLine=br.readLine())!=null){
trieDSA.insert(eachLine);
}
} catch (Exception e) {
e.printStackTrace();
} finally{
if(br!=null){
try {
br.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment