title: Finding the number of times each word in a hashset occurs in text document
body: <p>I'm implementing a Naive Bayes text classification algorithm in Java.</p>
  
  <p>What I have done so far is, declare a hashset called Vocabulary which stores all the unique words from a given text file (test file). </p>
  
  <p>One of the steps in the algorithm is to concatenate all the members of the test files into a single text file. This turns out to be a fairly big file with the words from each file.</p>
  
  <p>Now, I have to count the number of occurrences of each word in the Vocabulary with the concatenated text file. My first guess is to keep a sort of an array structure which contains the frequencies of each word. But then again, I would have way too many entries.</p>
  
  <p>Could anyone please give me better suggestions? </p>