public class SortedCounterSet<E extends java.lang.Comparable<? super E>> extends CounterSet<E>
map, total| Constructor and Description |
|---|
SortedCounterSet()
Create new counter array that orders its elements by the natural order.
|
SortedCounterSet(java.util.Comparator<? super E> comparator)
Create new counter array with specific comparator to define order.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getRangeSum(E firstElement,
E lastElement)
Obtain the sum of all values in a certain range of elements.
|
add, clear, contains, equals, getKeys, getKeysByValueAscending, getKeysByValueDescending, getTotal, getValue, hashCode, inc, inc, incAll, incAll, iterator, printValueDistribution, printValueDistribution, remove, removeAll, removeIf, removeSecondFromFirst, toMap, toMapWithoutZeroEntries, toString, valuespublic SortedCounterSet()
public SortedCounterSet(java.util.Comparator<? super E> comparator)
public int getRangeSum(E firstElement, E lastElement)
O(n*log(n)) where n is the size of
this set, as the list of items is sorted each time.firstElement - the first element to include. If the element is not present in the
list, the smallest element greater than this one is used.lastElement - the last element to include. If the element is not present in the
list, the largest element smaller than this one is used.