title: Collectors.toMap write a merge function on a different attribute of object than the one which is not used as value
body: <p>I need to create <code>Map&lt;String, String&gt;</code> from <code>List&lt;Person&gt;</code> using Stream API.</p>
  <pre><code>persons.stream()
         .collect(Collectors
              .toMap(Person::getNationality, Person::getName, (name1, name2) -&gt; name1)
  </code></pre>
  <p>But in the above case, I want to resolve conflict in name attribute by using Person's age. is there any way to pass merge function something around the lines <code>(age1, age2) -&gt; // if age1  is greater than age2 return name1, else return name2</code> ?</p>