sort and group a java collection
<p>I have an object which has a name and a score. I would like to sort a collection of such objects so that they are grouped by name and sorted by maximum score in each group (and within the group by descending score as well).</p>

<p>let me demonstrate what I intend to achieve. assume I have these objects(name, score):</p>

<p>(a, 3)<br>
(a, 9)<br>
(b, 7)<br>
(b, 10)<br>
(c, 8)<br>
(c, 3)</p>

<p>then I would like them to be sorted like this:</p>

<p>(b, 10)<br>
(b, 7)<br>
(a, 9)<br>
(a, 3)<br>
(c, 8)<br>
(c, 3)</p>

<p>is this feasible with a Comparator? I can't figure it out, so any hints would be appreciated.</p>
