Count distinct in java
<p>What's the easiest way to go from a collection of objects, to a hashmap of (Object,int), where each key contains an object of the initial collection, and its value is equal to the number of similar elements in that collection ?</p>
