Package ghidra.util.datastruct
Class LongIntHashtable
- java.lang.Object
- 
- ghidra.util.datastruct.LongIntHashtable
 
- 
- All Implemented Interfaces:
- java.io.Serializable
 - Direct Known Subclasses:
- AddableLongIntHashtable
 
 public class LongIntHashtable extends java.lang.Object implements java.io.SerializableClass that implements a hashtable with long keys and int values. Because this class uses array of primitives to store the information, it serializes very fast. This implementation uses separate chaining to resolve collisions.- See Also:
- Serialized Form
 
- 
- 
Constructor SummaryConstructors Constructor Description LongIntHashtable()Default constructor creates a table with an initial default capacity.LongIntHashtable(int capacity)Constructor creates a table with an initial given capacity.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(long key)Return true if the given key is in the hashtable.intget(long key)Returns the value for the given key.long[]getKeys()Returns an array containing all the long keys.voidput(long key, int value)Adds a key/value pair to the hashtable.booleanremove(long key)Removes a key from the hashtablevoidremoveAll()Remove all entries from the hashtable.intsize()Return the number of key/value pairs stored in the hashtable.
 
- 
- 
- 
Constructor Detail- 
LongIntHashtablepublic LongIntHashtable() Default constructor creates a table with an initial default capacity.
 - 
LongIntHashtablepublic LongIntHashtable(int capacity) Constructor creates a table with an initial given capacity. The capacity will be adjusted to the next highest prime in the PRIMES table.- Parameters:
- capacity- the initial capacity.
 
 
- 
 - 
Method Detail- 
putpublic void put(long key, int value)Adds a key/value pair to the hashtable. If the key is already in the table, the old value is replaced with the new value. If the hashtable is already full, the hashtable will attempt to approximately double in size (it will use a prime number), and all the current entries will be rehashed.- Parameters:
- key- the key to associate with the given value.
- value- the value to associate with the given key.
- Throws:
- java.lang.ArrayIndexOutOfBoundsException- thrown if the maximum capacity is reached.
 
 - 
getpublic int get(long key) throws NoValueExceptionReturns the value for the given key.- Parameters:
- key- the key whose associated value is to be returned.
- Throws:
- NoValueException- thrown if there is no value for the given key.
 
 - 
removepublic boolean remove(long key) Removes a key from the hashtable- Parameters:
- key- key to be removed from the hashtable.
- Returns:
- true if key is found and removed, false otherwise.
 
 - 
removeAllpublic void removeAll() Remove all entries from the hashtable.
 - 
containspublic boolean contains(long key) Return true if the given key is in the hashtable.- Parameters:
- key- the key whose presence in this map is to be tested.
 
 - 
sizepublic int size() Return the number of key/value pairs stored in the hashtable.
 - 
getKeyspublic long[] getKeys() Returns an array containing all the long keys.
 
- 
 
-