public final class Frequency<TYPE extends Comparable<TYPE>> extends Object
Constructor and Description |
---|
Frequency()
Creates a new Frequency instance.
|
Frequency(Comparator<TYPE> aComparator)
Creates a new Frequency instance using the given comparator for sorting the
added values.
|
Modifier and Type | Method and Description |
---|---|
void |
addValue(TYPE aValue)
Adds a given value to the distribution map.
|
void |
clear()
Clears all values from this frequency distribution.
|
long |
getCount(TYPE aValue)
Counts the number of occurrences of the given value.
|
TYPE |
getHighestRanked()
Returns the item with the highest count or rank.
|
TYPE |
getLowestRanked()
Returns the item with the lowest count or rank.
|
long |
getTotalCount()
Returns the number of entries in this frequency distribution map.
|
int |
getUniqueValueCount()
Returns the number of unique values in this frequency distribution map.
|
Iterable<TYPE> |
values()
Returns an iterator for the values in this frequency distribution map.
|
public Frequency()
public Frequency(Comparator<TYPE> aComparator)
aComparator
- the comparator to use for the distribution map, cannot be
null
.IllegalArgumentException
- in case the given comparator was null
.public void addValue(TYPE aValue)
aValue
- the value to add, cannot be null
.IllegalArgumentException
- in case the given value was null
.public void clear()
public long getCount(TYPE aValue)
aValue
- the value to count, cannot be null
.IllegalArgumentException
- in case the given value was null
.public TYPE getHighestRanked()
null
if this
frequency distribution is empty.public TYPE getLowestRanked()
null
if this
frequency distribution is empty.public long getTotalCount()
public int getUniqueValueCount()
Copyright © 2015 L'Xtreme IT consultancy. All rights reserved.