title: List of objects to map in java 8
body: <p>I have a class like this</p>
  
  <pre><code>ObjectA
  id 
  type
  </code></pre>
  
  <p>where id is unique but the type can be duplicate so if I have a list of ObjectA like this</p>
  
  <pre><code>(id, type) = (1, "A") , (2, "B"), (3, "C"), (4, "A")
  </code></pre>
  
  <p>then I want <code>Map&lt;type, List&lt;id&gt;&gt;</code> where 
  map is </p>
  
  <pre><code>&lt; "A",[1,4],
    "B",[2],
    "C",[3] &gt;
  </code></pre>
  
  <p>It is working with Java 7 but can't find a way to do it in Java 8. In Java 8 I can create key, value pair but not able to create a list if a type is same.</p>