edu.emory.mathcs.util.collections.longs
Class LongRadkeHashMap

java.lang.Object
  extended byedu.emory.mathcs.util.collections.longs.LongRadkeHashMap
All Implemented Interfaces:
java.lang.Cloneable, LongMap, java.io.Serializable

public class LongRadkeHashMap
extends java.lang.Object
implements LongMap, java.lang.Cloneable, java.io.Serializable

Hash map with long keys. It uses open addressing with quadratic residue search to avoid clustering. No additional memory per entry is needed, there is therefore no memory allocation on put() unless rehashing is required.

Version:
1.0
Author:
Dawid Kurzyniec
See Also:
Serialized Form

Constructor Summary
LongRadkeHashMap()
           
LongRadkeHashMap(int minInitialCapacity)
           
LongRadkeHashMap(int minInitialCapacity, float loadFactor, float resizeTreshold)
           
LongRadkeHashMap(int minInitialCapacity, long minKey, long maxKey)
           
LongRadkeHashMap(int minInitialCapacity, long minKey, long maxKey, float loadFactor, float resizeTreshold)
           
LongRadkeHashMap(LongMap m)
           
 
Method Summary
 void clear()
          Removes all the mappings.
 java.lang.Object clone()
           
 boolean containsKey(long key)
          Returns true if this map contains mapping for the specified number; false otherwise.
 boolean containsValue(java.lang.Object val)
          Returns true if this map contains mapping with the specified value; false otherwise.
 java.util.Set entrySet()
          Returns the view of entries in this map, as a Set of LongMap.Entry elements.
 boolean equals(java.lang.Object other)
           
 java.lang.Object get(long key)
          Retrieves the mapping for the specified number, or null if none.
 int hashCode()
           
 boolean isEmpty()
          Returns true if this map is empty; false otherwise.
 LongSet keySet()
          Returns the view of keys in this map, as a LongSet.
 java.lang.Object put(long key, java.lang.Object value)
          Maps specified value to the given long key, and returns the value previously mapped for that key, or null if there were no mapping for that key before.
 void putAll(LongMap map)
          Puts all mappings from the specified map into this map.
 java.lang.Object remove(long key)
          Removes the mapping for the given key and returns the removed value, or null if there was no mapping for that key.
 int size()
          Returns the number of entries in this map.
 long size64()
           
 java.lang.String toString()
           
 java.util.Collection values()
          Returns the read-only view of values in this map, as a Collection.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LongRadkeHashMap

public LongRadkeHashMap()

LongRadkeHashMap

public LongRadkeHashMap(int minInitialCapacity)

LongRadkeHashMap

public LongRadkeHashMap(int minInitialCapacity,
                        long minKey,
                        long maxKey)

LongRadkeHashMap

public LongRadkeHashMap(int minInitialCapacity,
                        float loadFactor,
                        float resizeTreshold)

LongRadkeHashMap

public LongRadkeHashMap(int minInitialCapacity,
                        long minKey,
                        long maxKey,
                        float loadFactor,
                        float resizeTreshold)

LongRadkeHashMap

public LongRadkeHashMap(LongMap m)
Method Detail

put

public java.lang.Object put(long key,
                            java.lang.Object value)
Description copied from interface: LongMap
Maps specified value to the given long key, and returns the value previously mapped for that key, or null if there were no mapping for that key before.

Specified by:
put in interface LongMap
Parameters:
key - the key
value - the value
Returns:
the value previously mapped to key, or null if none

get

public java.lang.Object get(long key)
Description copied from interface: LongMap
Retrieves the mapping for the specified number, or null if none.

Specified by:
get in interface LongMap
Parameters:
key - the search key
Returns:
the mapping for the specified number, or null if none.

containsKey

public boolean containsKey(long key)
Description copied from interface: LongMap
Returns true if this map contains mapping for the specified number; false otherwise.

Specified by:
containsKey in interface LongMap
Returns:
true if this map contains mapping for the specified number; false otherwise.

remove

public java.lang.Object remove(long key)
Description copied from interface: LongMap
Removes the mapping for the given key and returns the removed value, or null if there was no mapping for that key.

Specified by:
remove in interface LongMap
Parameters:
key - the key to remove the mapping for
Returns:
the value mapped to the key

containsValue

public boolean containsValue(java.lang.Object val)
Description copied from interface: LongMap
Returns true if this map contains mapping with the specified value; false otherwise. Usually, this method has a linear complexity.

Specified by:
containsValue in interface LongMap
Returns:
true if this map contains mapping with the specified value; false otherwise.

clear

public void clear()
Description copied from interface: LongMap
Removes all the mappings.

Specified by:
clear in interface LongMap

isEmpty

public boolean isEmpty()
Description copied from interface: LongMap
Returns true if this map is empty; false otherwise.

Specified by:
isEmpty in interface LongMap
Returns:
true if this map is empty; false otherwise.

size

public int size()
Description copied from interface: LongMap
Returns the number of entries in this map.

Specified by:
size in interface LongMap
Returns:
the number of entries in this map.

size64

public long size64()

putAll

public void putAll(LongMap map)
Description copied from interface: LongMap
Puts all mappings from the specified map into this map.

Specified by:
putAll in interface LongMap
Parameters:
map - the map to copy the mappings from.

keySet

public LongSet keySet()
Description copied from interface: LongMap
Returns the view of keys in this map, as a LongSet. The view is backed by this map. Supports removals.

Specified by:
keySet in interface LongMap
Returns:
the key set view of this map

entrySet

public java.util.Set entrySet()
Description copied from interface: LongMap
Returns the view of entries in this map, as a Set of LongMap.Entry elements. The view is backed by this map. Supports removals, and value changes via entry.setValue().

Specified by:
entrySet in interface LongMap
Returns:
the entry set view of this map

values

public java.util.Collection values()
Description copied from interface: LongMap
Returns the read-only view of values in this map, as a Collection. The view is backed by this map.

Specified by:
values in interface LongMap
Returns:
the value view of this map

equals

public boolean equals(java.lang.Object other)
Specified by:
equals in interface LongMap

hashCode

public int hashCode()
Specified by:
hashCode in interface LongMap

clone

public java.lang.Object clone()

toString

public java.lang.String toString()