title: How can I do the following using Java 8 Lambdas
body: <p>I have a set of Strings as follows</p>
  
  <pre><code>Set&lt;String&gt; ids;
  </code></pre>
  
  <p>Each id is of the form <code>#userId:#sessionId</code> so for e.g. <code>1:2</code> where 1 is the userId and 2 is the sessionId.</p>
  
  <p>I want to split these into userId which would be the key in a HashMap and each userId is unique. But each userId can have multiple sessions. So how do I get the values from <code>Set&lt;String&gt;</code> to <code>Map&lt;String, List&lt;String&gt;&gt;</code> </p>
  
  <p>For e.g. </p>
  
  <p>If the set contains the following values <code>{1:2, 2:2, 1:3}</code> 
  The map should contain</p>
  
  <pre><code>key=1 value=&lt;2,3&gt;
  key=2 value=&lt;2&gt;
  </code></pre>