title: How to write the merge function for Collectors.toMap()
body: <p>Here <code>UserMst</code> is the object and <code>users</code> is the List from which I get LoginId &amp;&amp; TenantId.</p>
  
  <pre><code>LinkedHashMap&lt;String, String&gt; Tmap = users.stream().collect(Collectors.toMap(
                      UserMst::getLoginId, UserMst::getTenantId,
                          (x, y)-&gt; ((x=="1") ? "Rocks" : (x=="2")
                                             ? "Mocks" : (x=="3")
                                             ? "Docs"  : (x=="4")
                                             ? "Pocks" : "")
                                     + " ,  " + ( (y=="1") ? "Rocks": (y=="2")
                                                           ? "Mocks": (y=="3")
                                                           ? "Docs" : (y=="4")
                                                           ? "Pocks": ""),
                          LinkedHashMap::new));
  
  
  ///////////////////
  
  LinkedHashMap&lt;String, String&gt; Tmap =
      users.stream().collect(
          Collectors.toMap( UserMst::getLoginId, UserMst::getTenantId,
          (x, y)-&gt; x + ", " + y, LinkedHashMap::new)); 
  
  ```
  
  It gives output as answer:: rajat=1,2,3 dave=1,2 milind=2,3
  I just need these 1,2,3,4 replaced with strings
  
  </code></pre>