title: How do I implement Javas Collections.addAll() with a HashMap<String, HashSet<Integer> >?
body: <p>I was trying to use the build in <code>Collections.addAll()</code> method but can not figure out the correct way to do so with the nested data structure. Any direction or documentation on this area would be greatly appreciated. </p>
  
  <pre><code>private Map&lt;String, Set&lt;Integer&gt;&gt; index;
  index = new HashMap&lt;String, Set&lt;Integer&gt;&gt;();
  
  if (index.containsKey(word) == false)
  {
      index.put(word, new HashSet&lt;&gt;());
  }
  
  public void addAll(String[] words)
  {
      // TODO Fill this in.
      for (String wordIndex : words)
      {
          wordIndex = clean(wordIndex);
          if (!index.containsKey(wordIndex))
          {
  
          }
      }
      // Collections.addAll(words, index);
      // for (String word : index.keySet())
      // {
      // System.out.printf("%d", word);
      //
      // for (Integer position : index.get(word))
      // {
      // System.out.printf(", %s", position);
      //
      // // add each word/position pair.
      // index.get(word).add(position);
      //
      // }
      // System.out.printf("%n");
      //
      // }
  }
  </code></pre>