title: Map with LIst using Collectors.toMap in Java 8
body: <p>I like convert below code to java stream,</p>
  
  <pre><code>HashMap&lt;String, List&lt;Data&gt;&gt; heMap = new HashMap&lt;String, List&lt;Data&gt;&gt;();
  for (Data heData : obj) {
      String id = heData.getData().getId() + heData.getPlanData().getCode()
              + heData.getPlanData().getId();
      if (!heMap.containsKey(id)) {
          CitizenHElist = new ArrayList&lt;Data&gt;();
  
          CitizenHElist.add(heData);
          heMap.put(id, CitizenHElist);
  
      } else {
          heMap.get(id).add(heData);
      }
  }
  </code></pre>
  
  <p>I tried the below code using stream, but i am not succeed on this.</p>
  
  <pre><code>heMap=obj.stream().collect(Collectors.toMap(t-&gt;getKey(t), obj.stream().collect(Collectors.toList())));
  
  private String getKey(Data heData){
      String id = heData.getData().getId() + heData.getPlanData().getCode()
                      + heData.getPlanData().getId();
      return id;
  }
  </code></pre>