T
- type parampublic class CountMap<T> extends Object implements Iterable<Map.Entry<T,Double>>
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(Collection<T> list)
Adds all elements of this collection with a value of 1
|
void |
add(Collection<T> list,
double value)
Adds all elements of this collection with the given value
|
void |
add(CountMap<T> other)
Adds a complete keymap to this key map.
|
Double |
add(T e)
adds T to the map and returns the number of occurences that are now logged
|
Double |
add(T e,
double inc)
increase the counter of the map by 'inc'.
|
void |
clear()
clears the map
|
Set<Map.Entry<T,Double>> |
entrySet() |
Double |
get(T needle)
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() |
double |
remove(T e)
Removes the entry from the map and returns the most recent associated value
|
Double |
set(T e,
double value)
Sets a specific value for this label, replacing any (posiibly) existing value
|
int |
size()
returns the amount of entries in the map
|
String |
toString() |
Collection<Double> |
values() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public CountMap()
public CountMap(Collection<? extends T> values)
public void add(Collection<T> list)
list
- elements to add to the mappublic void add(Collection<T> list, double value)
list
- elements to add to the mapvalue
- value used for each elementpublic void add(CountMap<T> other)
other
- Keymap whose elements will be addedpublic Double add(T e)
e
- adds this element with a vlaue of 1public Double add(T e, double inc)
e
- adds this elementinc
- amount to increasepublic Double set(T e, double value)
e
- adds this elementvalue
- set this amount for epublic double remove(T e)
e
- element to removepublic void clear()
public Double get(T needle)
needle
- the object to get the value forpublic Collection<Double> values()
public double getSum()
public int size()
Copyright © 2015. All Rights Reserved.