title: How to put together multiple Maps <Character, Set<String>> without overriding Sets
body: <p>In my project I am using two maps <code>Map&lt;Character, Set&lt;String&gt;&gt;.</code></p>
  
  <pre><code>map1 - is temporally holding needed values
  map2 - is summing all data from map1 after each loop
  </code></pre>
  
  <p>for example i got:</p>
  
  <pre><code>map2 = (B; Beryllium, Boron, Bromine)
  map2 = (H; Hellum, Hydrogen, Hafnium)
  </code></pre>
  
  <p>now new map1 is:</p>
  
  <pre><code>map1 = (B; Bismuth)
  map1 = (O; Oxygen)
  </code></pre>
  
  <p>In my code adding Oxygen as new entry is ok, but adding new entry for B ends by overraidding existing data in values and leave me only Bismuth.</p>
  
  <p>My code:</p>
  
  <pre class="lang-java prettyprint-override"><code> while (iterator.hasNext()) {
     Set&lt;String&gt; words = new TreeSet&lt;&gt;();
     String word = iterator.next();
     char[] wordChars = word.toCharArray();
  
  //some code
  
     words.add(word);
     map1.put(wordChars[i], words);
  
  }
  map2.putAll(map1);
  </code></pre>
  
  <p>I tought about using .merge but I have no idea how to use it with Sets as values, and I cannot use simple Strings with concat.</p>