title: The best way to store and access 120,000 words in java
body: <p>I'm programming a java application that reads strictly text files (.txt).  These files can contain upwards of 120,000 words. </p>
  
  <p>The application needs to store all +120,000 words. It needs to name them word_1, word_2, etc. And it also needs to access these words to perform various methods on them.</p>
  
  <p>The methods all have to do with Strings. For instance, a method will be called to say how many letters are in word_80. Another method will be called to say what specific letters are in word_2200.</p>
  
  <p>In addition, some methods will compare two words. For instance, a method will be called to compare word_80 with word_2200 and needs to return which has more letters. Another method will be called to compare word_80 with word_2200 and needs to return what specific letters both words share.</p>
  
  <p>My question is: Since I'm working almost exclusively with Strings, is it best to store these words in one large ArrayList? Several small ArrayLists? Or should I be using one of the many other storage possibilities, like Vectors, HashSets, LinkedLists?</p>
  
  <p>My two primary concerns are 1.) access speed, and 2.) having the greatest possible number of pre-built methods at my disposal.</p>
  
  <p>Thank you for your help in advance!!</p>
  
  <hr>
  
  <p>Wow! Thanks everybody for providing such a quick response to my question. All your suggestions have helped me immensely. I’m thinking through and considering all the options provided in your feedback. </p>
  
  <p>Please forgive me for any fuzziness; and let me address your questions:</p>
  
  <ol>
  <li><p>Q) English?<br>
  A) The text files are actually books written in English. The occurrence of a word in a second language would be rare – but not impossible. I’d put the percentage of non-English words in the text files at .0001%</p></li>
  <li><p>Q) Homework?<br>
  A) I’m smilingly looking at my question’s wording now. Yes, it does resemble a school assignment. But no, it’s not homework.</p></li>
  <li><p>Q) Duplicates?<br>
  A) Yes. And probably every five or so words, considering conjunctions, articles, etc.</p></li>
  <li><p>Q) Access?<br>
  A) Both random and sequential. It’s certainly possible a method will locate a word at random. It’s equally possible a method will want to look for a matching word between word_1 and word_120000 sequentially. Which leads to the last question…</p></li>
  <li><p>Q) Iterate over the whole list?<br>
  A) Yes.</p></li>
  </ol>
  
  <p>Also, I plan on growing this program to perform many other methods on the words. I apologize again for my fuzziness. (Details do make a world of difference, do they not?)</p>
  
  <p>Cheers!</p>