edu.berkeley.nlp.lm.collections
Class LongToIntHashMap

java.lang.Object
  extended by 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

Nested Class Summary
 class LongToIntHashMap.Entry
           
 
Constructor Summary
LongToIntHashMap()
           
LongToIntHashMap(int initCapacity_)
           
 
Method Summary
 void clear()
           
 LongToIntHashMap copy()
           
 void ensureCapacity(int capacity)
           
 Iterable<Map.Entry<Long,Integer>> entries()
           
 int get(long k, int def)
           
 List<LongToIntHashMap.Entry> getObjectsSortedByValue(boolean descending)
           
 void incrementCount(long k, int d)
           
 boolean isEmpty()
           
 Iterable<Long> keySet()
           
 Iterable<LongToIntHashMap.Entry> primitiveEntries()
           
 void put(Long k, int v)
           
 void setLoadFactor(double loadFactor)
           
 int size()
           
 void toSorted()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LongToIntHashMap

public LongToIntHashMap()

LongToIntHashMap

public LongToIntHashMap(int initCapacity_)
Method Detail

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()