title: HashMap updating ArrayList
body: <p>I'm just starting to learn to use HashMap and reading the java tutorial, but I'm having trouble.</p>
  
  <p>I'm trying to update the List inside a HashMap but I want to get the List of that key, is there a way to update a specific List of the key instead of having to make...5 different Lists and updating those?</p>
  
  <pre><code> HashMap&lt;String, ArrayList&lt;String&gt;&gt; mMap = new HashMap&lt;String, ArrayList&lt;String&gt;&gt;();
          ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;();
          mMap.put("A", list);
          mMap.put("B", list);
          mMap.put("C", list);
          mMap.put("D", list);
  
          Iterator iter = mMap.entrySet().iterator();
  
          if (mMap.containsKey("A"))
          {   
              Map.Entry mEntry = (Map.Entry) iter.next();
              list.add("test");
              mMap.put("A",list);
              System.out.println(mEntry.getKey() + " : " + mEntry.getValue());
          }
          else if (mMap.containsKey("B"))
          {   
              Map.Entry mEntry = (Map.Entry) iter.next();
              list.add("entry");
              mMap.put("B",list);
              System.out.println(mEntry.getKey() + " : " + mEntry.getValue());
          }
  </code></pre>