Package edu.berkeley.nlp.lm.collections
Class LongToIntHashMap
- java.lang.Object
-
- edu.berkeley.nlp.lm.collections.LongToIntHashMap
-
public final class LongToIntHashMap extends java.lang.ObjectOpen 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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classLongToIntHashMap.Entry
-
Constructor Summary
Constructors Constructor Description LongToIntHashMap()LongToIntHashMap(int initCapacity_)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()LongToIntHashMapcopy()voidensureCapacity(int capacity)java.lang.Iterable<java.util.Map.Entry<java.lang.Long,java.lang.Integer>>entries()intget(long k, int def)java.util.List<LongToIntHashMap.Entry>getObjectsSortedByValue(boolean descending)voidincrementCount(long k, int d)booleanisEmpty()java.lang.Iterable<java.lang.Long>keySet()java.lang.Iterable<LongToIntHashMap.Entry>primitiveEntries()voidput(java.lang.Long k, int v)voidsetLoadFactor(double loadFactor)intsize()voidtoSorted()java.lang.StringtoString()
-
-
-
Method Detail
-
setLoadFactor
public void setLoadFactor(double loadFactor)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
toSorted
public void toSorted()
-
put
public void put(java.lang.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 java.lang.Iterable<java.util.Map.Entry<java.lang.Long,java.lang.Integer>> entries()
-
ensureCapacity
public void ensureCapacity(int capacity)
-
size
public int size()
-
primitiveEntries
public java.lang.Iterable<LongToIntHashMap.Entry> primitiveEntries()
-
keySet
public java.lang.Iterable<java.lang.Long> keySet()
-
clear
public void clear()
-
getObjectsSortedByValue
public java.util.List<LongToIntHashMap.Entry> getObjectsSortedByValue(boolean descending)
-
copy
public LongToIntHashMap copy()
-
-