Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Start {
- public static void main(String[] args) throws IOException {
- TableHashDC<String> table= new TableHashDC<String>();
- TreeMapDC<String> tree = new TreeMapDC<String>();
- FileReader f = new FileReader("C:\\Users\\salva\\eclipse-workspace\\progetto\\src\\progetto\\prova.txt");
- BufferedReader b = new BufferedReader(f);
- String s;
- String[] stringhe = new String[90]; //vedere quanto spazio ha allocato per ospitare le stringhe di una riga
- while(true) {
- s=b.readLine();
- if(s==null)
- break;
- stringhe= s.split(" ");
- for(int i = 0; i< stringhe.length; i++) {
- if (!table.containsKey(stringhe[i])) {
- stringhe[i]=stringhe[i].toLowerCase();
- table.insertEl(stringhe[i], 1);
- tree.insertEl(stringhe[i], 1);
- } else {
- stringhe[i]=stringhe[i].toLowerCase();
- table.incCount(stringhe[i]);
- tree.incCount(stringhe[i]);
- }
- } //for
- } //while
- }//main
- }// class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement