public class SizedConcurrentHashMap extends NullSafeConcurrentHashMap implements SizedMap, ConcurrentMap, Serializable
SizedMap
that uses JDK1.5 concurrency primitivesNullSafeConcurrentHashMap.KeyFilter
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Constructor and Description |
---|
SizedConcurrentHashMap(int size,
float load,
int concurrencyLevel) |
Modifier and Type | Method and Description |
---|---|
int |
getMaxSize()
The maximum number of entries, or Integer.MAX_VALUE for no limit.
|
boolean |
isFull()
Whether the map is full.
|
void |
overflowRemoved(Object key,
Object value)
This implementation does nothing.
|
Object |
put(Object key,
Object value) |
Object |
putIfAbsent(Object key,
Object value) |
protected void |
removeOverflow()
Equivalent to
removeOverflow(false) . |
protected void |
removeOverflow(boolean forPut)
Removes overflow.
|
void |
setMaxSize(int max)
The maximum number of entries, or Integer.MAX_VALUE for no limit.
|
contains, containsKey, containsValue, elements, entrySet, get, keys, keySet, randomEntryIterator, remove, remove, removeRandom, replace, replace, values
clear, isEmpty, putAll, size
clone, equals, hashCode, toString
finalize, getClass, notify, notifyAll, wait, wait, wait
randomEntryIterator, removeRandom
public SizedConcurrentHashMap(int size, float load, int concurrencyLevel)
size
- the maximum size of this map. If additional elements are
put into the map, overflow will be removed via calls to
overflowRemoved(java.lang.Object, java.lang.Object)
.load
- the load factor for the underlying mapconcurrencyLevel
- the concurrency level for the underlying mapConcurrentHashMap
public Object putIfAbsent(Object key, Object value)
putIfAbsent
in interface ConcurrentMap
putIfAbsent
in class NullSafeConcurrentHashMap
public Object put(Object key, Object value)
put
in interface Map
put
in class NullSafeConcurrentHashMap
public int getMaxSize()
SizedMap
getMaxSize
in interface SizedMap
public void setMaxSize(int max)
SizedMap
setMaxSize
in interface SizedMap
protected void removeOverflow()
removeOverflow(false)
.protected void removeOverflow(boolean forPut)
forPut
is true
, then
this uses size() + 1
when computing size.public boolean isFull()
SizedMap
public void overflowRemoved(Object key, Object value)
overflowRemoved
in interface SizedMap
Copyright © 2006-2012 Apache Software Foundation. All Rights Reserved.