Maintains a frequency distribution.
Accepts int, long, char or Comparable values. New values added must be comparable to those that have been added, otherwise the add method will throw an IllegalArgumentException.
Integer values (int, long, Integer, Long) are not distinguished by type -- i.e. addValue(Long.valueOf(2)), addValue(2), addValue(2l)
all have the same effect (similarly for arguments to getCount,
etc.).
char values are converted by addValue
to Character instances. As such, these values are not comparable to integral values, so attempts to combine integral types with chars in a frequency distribution will fail.
The values are ordered using the default (natural order), unless a Comparator
is supplied in the constructor.
@version $Revision: 1054186 $ $Date: 2011-01-01 03:28:46 +0100 (sam. 01 janv. 2011) $