title: java loop and add values to a map
body: <p>New to using map and was wondering how to add values and loop thur it to retrieve the values.  Below is my code:</p>
  
  <pre><code>Map&lt;String, List&lt;String&gt;&gt; map = new LinkedHashMap&lt;String, List&lt;String&gt;&gt;();
  
  for ( int i = 0, m = 1; i &lt; visualcategory.size(); i = i+2, m = m+2) {
      String categoryName = visualcategory.get(m);
      map.put(categoryName , null);
  }
  </code></pre>
  
  <p>for which i will be having this which is im assuming is correct even with the null</p>
  
  <pre><code>MAP {5=null, 11=null, 15=null, 24=null, 96=null, 98=null}
  </code></pre>
  
  <p>Its currently null as the next process (below) will fill up that list as it loops thru a for condition unless it can be done to add the categoryName and the List values at the same time?</p>
  
  <p>Now, i need to loop and add a list from each string/map</p>
  
  <pre><code>String value1 = value;
  String value2 = value;
  
  for (Entry&lt;String, List&lt;String&gt;&gt; entry : map.entrySet()) {
      map.put(value1, entry.getValue());  --&gt; doesn't work
      map.put(value2, entry.getValue());  --&gt; doesn't work
  }
  </code></pre>
  
  <p>I need something like this</p>
  
  <pre><code>MAP {5=[value1,value2,etc], 11=[value1,value2,etc], .......
  </code></pre>
  
  <p>Problem is, it doesn't work I can't seem to add inside the List. I need help on how to add values from a map > and loop thru to it?</p>