The contract as stated in the javadoc is:
* Maintains a frequency distribution.
* <p>
* Accepts int, long, char or Object values. New values added must be
* comparable to those that have been added, otherwise the add method will
* throw an IllegalArgumentException.
* <p>
* Integer values (int, long, Integer, Long) are not distinguished by type --
* i.e. <code>addValue(new Long(2)), addValue(2), addValue(2l)</code> all have
* the same effect (similarly for arguments to <code>getCount,</code> etc.).
* <p>
* The values are ordered using the default (natural order), unless a
* <code>Comparator</code>is supplied in the constructor.
Integer values are all stored as Long instances in the TreeMap. The problem is in addValue(object),
which should treat Integer instances specially. I will fix this. Thanks for reporting the
problem.
Phil