public class FrequencySet<T>
extends java.util.HashMap<T,java.lang.Integer>
Modifier and Type | Class and Description |
---|---|
private class |
FrequencySet.FrequencyComparator |
Constructor and Description |
---|
FrequencySet() |
Modifier and Type | Method and Description |
---|---|
private void |
_add(T value,
int v) |
void |
add(T value)
Add a value to the set.
|
void |
add0(T value)
Add a value to the set with 0 occurences.
|
java.util.List<T> |
createFrequencyBasedList()
Create an ordered list of values in the order of decreasing frequency
of occurence.
|
java.util.Set<T> |
createFrequencyBasedSet()
Create an ordered set of values in the order of decreasing frequency
of occurence.
|
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
public void add(T value)
value
- the value to put in the set.public void add0(T value)
value
- the value to put in the set.private void _add(T value, int v)
public java.util.List<T> createFrequencyBasedList()
public java.util.Set<T> createFrequencyBasedSet()