edu.berkeley.nlp.lm.collections
Class LongToIntHashMap
java.lang.Object
edu.berkeley.nlp.lm.collections.LongToIntHashMap
public final class LongToIntHashMap
- extends Object
Open address hash map with linear probing. Assumes keys are non-negative
(uses -1 internally for empty key). Returns 0.0 for keys not in the map.
- Author:
- adampauls
LongToIntHashMap
public LongToIntHashMap()
LongToIntHashMap
public LongToIntHashMap(int initCapacity_)
setLoadFactor
public void setLoadFactor(double loadFactor)
toString
public String toString()
- Overrides:
toString
in class Object
toSorted
public void toSorted()
put
public void put(Long k,
int v)
incrementCount
public void incrementCount(long k,
int d)
get
public int get(long k,
int def)
isEmpty
public boolean isEmpty()
entries
public Iterable<Map.Entry<Long,Integer>> entries()
ensureCapacity
public void ensureCapacity(int capacity)
size
public int size()
primitiveEntries
public Iterable<LongToIntHashMap.Entry> primitiveEntries()
keySet
public Iterable<Long> keySet()
clear
public void clear()
getObjectsSortedByValue
public List<LongToIntHashMap.Entry> getObjectsSortedByValue(boolean descending)
copy
public LongToIntHashMap copy()