|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.mapdb.LongMap<V>
org.mapdb.LongConcurrentHashMap<V>
public class LongConcurrentHashMap<V>
Thread safe LongMap. Is refactored version of 'ConcurrentHashMap'
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.mapdb.LongMap |
|---|
LongMap.LongMapIterator<V> |
| Field Summary | |
|---|---|
protected long |
hashSalt
Salt added to keys before hashing, so it is harder to trigger hash collision attack. |
| Constructor Summary | |
|---|---|
LongConcurrentHashMap()
Creates a new, empty map with a default initial capacity (16), load factor (0.75) and concurrencyLevel (16). |
|
LongConcurrentHashMap(int initialCapacity)
Creates a new, empty map with the specified initial capacity, and with default load factor (0.75) and concurrencyLevel (16). |
|
LongConcurrentHashMap(int initialCapacity,
float loadFactor,
int concurrencyLevel)
Creates a new, empty map with the specified initial capacity, load factor and concurrency level. |
|
| Method Summary | |
|---|---|
void |
clear()
Removes all of the mappings from this map. |
boolean |
containsKey(long key)
Tests if the specified object is a key in this table. |
boolean |
containsValue(Object value)
Returns true if this map maps one or more keys to the specified value. |
V |
get(long key)
Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key. |
boolean |
isEmpty()
Returns true if this map contains no key-value mappings. |
LongMap.LongMapIterator<V> |
longMapIterator()
|
V |
put(long key,
V value)
Maps the specified key to the specified value in this table. |
V |
putIfAbsent(long key,
V value)
|
V |
remove(long key)
Removes the key (and its corresponding value) from this map. |
boolean |
remove(long key,
Object value)
|
V |
replace(long key,
V value)
|
boolean |
replace(long key,
V oldValue,
V newValue)
|
int |
size()
Returns the number of key-value mappings in this map. |
Iterator<V> |
valuesIterator()
|
| Methods inherited from class org.mapdb.LongMap |
|---|
toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected final long hashSalt
| Constructor Detail |
|---|
public LongConcurrentHashMap(int initialCapacity,
float loadFactor,
int concurrencyLevel)
initialCapacity - the initial capacity. The implementation
performs internal sizing to accommodate this many elements.loadFactor - the load factor threshold, used to control resizing.
Resizing may be performed when the average number of elements per
bin exceeds this threshold.concurrencyLevel - the estimated number of concurrently
updating threads. The implementation performs internal sizing
to try to accommodate this many threads.
IllegalArgumentException - if the initial capacity is
negative or the load factor or concurrencyLevel are
nonpositive.public LongConcurrentHashMap(int initialCapacity)
initialCapacity - the initial capacity. The implementation
performs internal sizing to accommodate this many elements.
IllegalArgumentException - if the initial capacity of
elements is negative.public LongConcurrentHashMap()
| Method Detail |
|---|
public boolean isEmpty()
isEmpty in class LongMap<V>LongMap.size()public int size()
size in class LongMap<V>public Iterator<V> valuesIterator()
valuesIterator in class LongMap<V>public LongMap.LongMapIterator<V> longMapIterator()
longMapIterator in class LongMap<V>public V get(long key)
null if this map contains no mapping for the key.
More formally, if this map contains a mapping from a key
k to a value keys such that key.equals(k),
then this method returns keys; otherwise it returns
null. (There can be at most one such mapping.)
get in class LongMap<V>key - the key.
null
if no mapping for the specified key is found.
NullPointerException - if the specified key is nullpublic boolean containsKey(long key)
key - possible key
NullPointerException - if the specified key is nullpublic boolean containsValue(Object value)
value - value whose presence in this map is to be tested
NullPointerException - if the specified value is null
public V put(long key,
V value)
The value can be retrieved by calling the get method with a key that is equal to the original key.
put in class LongMap<V>key - key with which the specified value is to be associatedvalue - value to be associated with the specified key
NullPointerException - if the specified key or value is null
public V putIfAbsent(long key,
V value)
NullPointerException - if the specified key or value is nullpublic V remove(long key)
remove in class LongMap<V>key - the key that needs to be removed
NullPointerException - if the specified key is null
public boolean remove(long key,
Object value)
NullPointerException - if the specified key is null
public boolean replace(long key,
V oldValue,
V newValue)
NullPointerException - if any of the arguments are null
public V replace(long key,
V value)
NullPointerException - if the specified key or value is nullpublic void clear()
clear in class LongMap<V>LongMap.isEmpty(),
LongMap.size()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||