K
- the key typepublic class TallyMap<K> extends Object
TallyMapLong
Constructor and Description |
---|
TallyMap() |
Modifier and Type | Method and Description |
---|---|
int |
dec(K key)
Decrement the count associated with the specified key by 1.
|
int |
dec(K key,
int amount)
Decrement the count associated with the specified key by the given
amount.
|
int |
get(K key)
Returns the count associated with the specified key.
|
K |
getHighestKey()
Returns the key that is "highest" in the natural ordering of
the K class, and is also present (has a non-zero count) in the map.
|
Set<K> |
getKeys()
Returns the key set for the backing map.
|
int |
getTotal()
Returns the sum of all values in the map; i.e. the Grand Total.
|
int |
inc(K key)
Increment the count associated with the specified key by 1.
|
int |
inc(K key,
int amount)
Increment the count associated with the specified key by the given
amount.
|
String |
toString() |
public int inc(K key)
key
- the keypublic int inc(K key, int amount)
key
- the keyamount
- the amount to increment bypublic int dec(K key)
key
- the keypublic int dec(K key, int amount)
key
- the keyamount
- the amount to decrement bypublic int get(K key)
key
- the keypublic Set<K> getKeys()
public int getTotal()
public K getHighestKey()
Copyright © 2015. All Rights Reserved.