Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package histogram_words;
- import java.io.*;
- import java.util.Scanner;
- public class Histogram {
- public static void main(String[] args) {
- try {
- Scanner s=new Scanner(new File("short.txt"));
- MyHashTable table=new MyHashTable(1000);
- while (s.hasNext()) {
- String word=s.next();
- int occurence=table.get(word);
- table.add(word, occurence+1);
- }
- System.out.print(table);
- } catch (FileNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
RAW Paste Data