T
- You probably want to use com.google.common.collect.Multiset instead if you only need integer countspublic class CountMap<T> extends Object implements Iterable<Map.Entry<T,Double>>
http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/collect/Multiset.html
Constructor and Description |
---|
CountMap() |
CountMap(Collection<? extends T> values) |
CountMap(CountMap<? extends T> other)
Initialize the countmap with the content of another count map.
|
Modifier and Type | Method and Description |
---|---|
void |
add(CountMap<T> other)
Adds a complete keymap to this key map.
|
Double |
add(T t)
adds T to the map and returns the number of occurences that are now logged
|
Double |
add(T t,
double inc)
increase the counter of the map by 'inc'.
|
void |
addAll(Collection<T> list)
Adds all elements of this collection with a value of 1
|
void |
addAll(Collection<T> list,
double value)
Adds all elements of this collection with the given value
|
Double |
get(T label)
Returns the current value for the given label.
|
double |
getSum()
returns the sum of all values - NOT the size of the map!
|
Iterator<Map.Entry<T,Double>> |
iterator() |
Set<T> |
keySet() |
int |
size() |
String |
toString() |
Collection<Double> |
values() |
public CountMap()
public CountMap(Collection<? extends T> values)
public void addAll(Collection<T> list)
list
- #addAll(java.util.Collection, int)
public void addAll(Collection<T> list, double value)
list
- value
- public void add(CountMap<T> other)
other
- Keymap whose elements will be addedpublic Double add(T t)
t
- public Double add(T t, double inc)
t
- inc
- public Double get(T label)
label
- public Collection<Double> values()
public double getSum()
public int size()
Copyright © 2012. All Rights Reserved.