title: Lambda Expression to create a map with Integer as key and List as value
body: <p>Question : Solve the following via lambda Expressions. Given a list of Strings, create a map where </p>
  
  <pre><code>Key=Integer(string.length)
  value=List
  </code></pre>
  
  <p>If two strings matches with the length, create a list of all such matching length of strings.</p>
  
  <p>I have no clue as how to create a list for all matching strings lengths within the stream!! I tried the following way, which gives me exception of duplicate Key, which is obvious.</p>
  
  <pre><code>private static void changeToMap(List&lt;String&gt; listString)
  {
      Map&lt;Integer, String&gt; map=listString.stream().collect(Collectors.toMap(x-&gt;x.toString().length(),x-&gt;x));
      System.out.println(map);        
  }
  </code></pre>