title: Searching for a value in an ArrayList that is stored in a HashMap
body: <p>I am trying to figure out how to retrieve a value that is stored in an ArrayList, stored in a Hashmap.</p>
  
  <p>Here's what I have:</p>
  
  <pre><code>HashMap&lt;String, ArrayList&lt;Record&gt;&gt; records = new HashMap&lt;&gt;();
  </code></pre>
  
  <p>The key in this hashmap is not what I am looking for. There is a method inside of the Record object called <code>getRecordId()</code> and I want to be able to evaluate whether or not this <code>recordId</code>, through an if statement, exists in the ArrayList.</p>
  
  <p>Example:</p>
  
  <pre><code>if(records.values.exists(recordId)){ ...do something ...}
  </code></pre>
  
  <p>Essentially, I want to loop through all the values in the ArrayList to see if that record ID exists, and if it does, I will store the key and compute some things. How to I do this?</p>
  
  <p>Edit: right after posting this question, I think I am on to something. How about this:</p>
  
  <pre><code>Set&lt;Map.Entry&lt;String, ArrayList&lt;Record&gt;&gt;&gt; entrySet = records.entrySet();
  for(Map.Entry&lt;String, ArrayList&lt;Record&gt;&gt; data : entrySet)
  {
      for(Record entry : data.getValue())
      {
          if(recordId.equals(entry.getRecordId()))
          {
              // Do something here
              return "";
          }
      }
  }
  </code></pre>
  
  <p>I need to leave the loops if the record ID has been found, because record IDs are unique.</p>