Data structure to count frequency of equal items
<p>I need to have data structure like <code>HashSet</code>. </p>

<ol>
<li>It should not add the same item into the collection</li>
<li>But instead of adding the same item, it should count times this item was added.</li>
</ol>

<p>As I understand <code>HashSet</code> calculates <code>hashCode</code> at first, if <code>hashCode</code> is the same it checks <code>equals</code> method if true than it will not add an item, otherwise item with the same <code>hashCode</code> but another <code>equals</code> will be added to the bucket linked list.    </p>

<p>What I need to do is just keep only unique objects like <code>Set</code> does, but using <code>equals</code> method only, and if objects are equal than increment counter associated with each object.    </p>

<p>Is there any such data structure already implemented, or I should create my own ? </p>