|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.cassandra.utils.FastHash
org.apache.cassandra.utils.FastObjectHash<K>
org.apache.cassandra.utils.FastHashMap<K,V>
public class FastHashMap<K,V>
An implementation of the Map interface which uses an open addressed hash table to store its contents
Nested Class Summary | |
---|---|
protected class |
FastHashMap.FastHashMapIterator<T>
|
protected class |
FastHashMap.KeyView
a view onto the keys of the map. |
Field Summary | |
---|---|
protected V[] |
values_
the values of the map |
Fields inherited from class org.apache.cassandra.utils.FastObjectHash |
---|
FREE, REMOVED, set_ |
Fields inherited from class org.apache.cassandra.utils.FastHash |
---|
autoCompactionFactor_, autoCompactRemovesRemaining_, DEFAULT_INITIAL_CAPACITY, DEFAULT_LOAD_FACTOR, free_, loadFactor_, maxSize_, size_ |
Constructor Summary | |
---|---|
FastHashMap()
Creates a new FastHashMap instance with the default capacity
and load factor. |
|
FastHashMap(int initialCapacity)
Creates a new FastHashMap instance with a prime capacity
equal to or greater than initialCapacity and with the default
load factor. |
|
FastHashMap(int initialCapacity,
float loadFactor)
Creates a new FastHashMap instance with a prime capacity
equal to or greater than initialCapacity and with the
specified load factor. |
|
FastHashMap(java.util.Map<K,V> map)
Creates a new FastHashMap instance which contains the
key/value pairs in map. |
Method Summary | |
---|---|
void |
clear()
Empties the map. |
FastHashMap<K,V> |
clone()
|
boolean |
containsKey(java.lang.Object key)
checks for the present of key in the keys of the map. |
boolean |
containsValue(java.lang.Object val)
checks for the presence of val in the values of the map. |
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet()
Returns a Set view on the entries of the map. |
V |
get(java.lang.Object key)
retrieves the value for key |
java.util.Set<K> |
keySet()
returns a Set view on the keys of the map. |
static void |
main(java.lang.String[] args)
|
V |
put(K key,
V value)
Inserts a key/value pair into the map. |
void |
putAll(java.util.Map<? extends K,? extends V> map)
copies the key/value mappings in map into this map. |
protected void |
rehash(int newCapacity)
rehashes the map to the new capacity. |
V |
remove(java.lang.Object key)
Deletes a key/value pair from the map. |
protected void |
removeAt(int index)
removes the mapping at index from the map. |
protected int |
setUp(int initialCapacity)
initialize the value array of the map. |
java.util.Collection<V> |
values()
Returns a view on the values of the map. |
Methods inherited from class org.apache.cassandra.utils.FastObjectHash |
---|
capacity, computeHashCode, contains, equals, index, insertionIndex, throwObjectContractViolation |
Methods inherited from class org.apache.cassandra.utils.FastHash |
---|
calculateGrownCapacity, compact, ensureCapacity, getAutoCompactionFactor, isEmpty, postInsertHook, reenableAutoCompaction, setAutoCompactionFactor, size, tempDisableAutoCompaction, trimToSize |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Map |
---|
equals, hashCode, isEmpty, size |
Field Detail |
---|
protected transient V[] values_
Constructor Detail |
---|
public FastHashMap()
FastHashMap
instance with the default capacity
and load factor.
public FastHashMap(int initialCapacity)
FastHashMap
instance with a prime capacity
equal to or greater than initialCapacity and with the default
load factor.
initialCapacity
- an int
valuepublic FastHashMap(int initialCapacity, float loadFactor)
FastHashMap
instance with a prime capacity
equal to or greater than initialCapacity and with the
specified load factor.
initialCapacity
- an int
valueloadFactor
- a float
valuepublic FastHashMap(java.util.Map<K,V> map)
FastHashMap
instance which contains the
key/value pairs in map.
map
- a Map
valueMethod Detail |
---|
public FastHashMap<K,V> clone()
clone
in class FastObjectHash<K>
protected int setUp(int initialCapacity)
setUp
in class FastObjectHash<K>
initialCapacity
- an int
value
int
valuepublic V put(K key, V value)
put
in interface java.util.Map<K,V>
key
- an Object
valuevalue
- an Object
value
protected void rehash(int newCapacity)
rehash
in class FastHash
newCapacity
- an int
valuepublic V get(java.lang.Object key)
get
in interface java.util.Map<K,V>
key
- an Object
value
public void clear()
clear
in interface java.util.Map<K,V>
clear
in class FastHash
public V remove(java.lang.Object key)
remove
in interface java.util.Map<K,V>
key
- an Object
value
Object
valueprotected void removeAt(int index)
removeAt
in class FastObjectHash<K>
index
- an int
valuepublic java.util.Collection<V> values()
values
in interface java.util.Map<K,V>
Collection
valuepublic java.util.Set<K> keySet()
keySet
in interface java.util.Map<K,V>
Set
valuepublic java.util.Set<java.util.Map.Entry<K,V>> entrySet()
entrySet
in interface java.util.Map<K,V>
Set
valuepublic boolean containsValue(java.lang.Object val)
containsValue
in interface java.util.Map<K,V>
val
- an Object
value
boolean
valuepublic boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map<K,V>
key
- an Object
value
boolean
valuepublic void putAll(java.util.Map<? extends K,? extends V> map)
putAll
in interface java.util.Map<K,V>
map
- a Map
valuepublic static void main(java.lang.String[] args) throws java.lang.Throwable
java.lang.Throwable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |