title: How do I find the index of multiple objects in an ArrayList when they are identitcal
body: <p>In this I am storing words in one arraylist and the respective phone-number that corresponds to it in another arraylist. I want to be able to enter a number and return all words in the other list that correspond. I have my arraylists setup like this.</p>
  
  <pre><code>List&lt;String&gt; listWords = new ArrayList&lt;String&gt;(); // An ArrayList which stores all added words.
  List&lt;String&gt; listNum = new ArrayList&lt;String&gt;();// An ArrayList which stores all phone numbers that correspond to all the added words
  </code></pre>
  
  <p>The words are converted as they would on a phone keypad (i.e. 2 = a,b,c  3 = d,e,f etc).</p>
  
  <p>Also I am adding the words simply like this;</p>
  
  <pre><code>public void readWords() 
  {
      PhoneWords ph = new PhoneWords();
      try
      {
          // Open the file that is the first 
          // command line parameter
          FileInputStream fstream = new FileInputStream("words.txt");
  
          BufferedReader br = new BufferedReader(new InputStreamReader(fstream));
          String strLine;
  
          //Read File Line By Line
          while ((strLine = br.readLine()) != null)   
          {
              String phNum = ph.word2Num(strLine);
              listWords.add(position, strLine);
              listNum.add(position, phNum);
              position++; // index position, only used when initally adding the words
          }
  
      }catch (Exception e)
      {
          //Catch exception if any
          System.err.println("Error: " + e.getMessage());
      }
  </code></pre>