public class ConcurrentLruObjectMap<K,V> extends LruObjectMap<K,V> implements ConcurrentCollection
Modifier and Type | Field and Description |
---|---|
protected ReadWriteLock |
lock |
DEFAULT_MAX_CAPACITY
Constructor and Description |
---|
ConcurrentLruObjectMap() |
ConcurrentLruObjectMap(int initialCapacity) |
ConcurrentLruObjectMap(int initialCapacity,
float loadFactor) |
ConcurrentLruObjectMap(int initialCapacity,
int maxCapacity) |
ConcurrentLruObjectMap(int initialCapacity,
int maxCapacity,
float loadFactor) |
ConcurrentLruObjectMap(org.mini2Dx.gdx.utils.ObjectMap<? extends K,? extends V> map)
NOTE: read access to the other map is not thread-safe
|
ConcurrentLruObjectMap(org.mini2Dx.gdx.utils.ObjectMap<? extends K,? extends V> map,
int maxCapacity)
NOTE: read access to the other map is not thread-safe
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears the map, leaving the backing arrays at the current capacity.
|
void |
clear(int maximumCapacity)
Clears the map and reduces the size of the backing arrays to be the specified capacity, if they are larger.
|
boolean |
containsKey(K key) |
boolean |
containsValue(java.lang.Object value,
boolean identity)
Returns true if the specified value is in the map.
|
void |
ensureCapacity(int additionalCapacity)
Increases the size of the backing array to accommodate the specified number of additional items.
|
org.mini2Dx.gdx.utils.ObjectMap.Entries<K,V> |
entries()
Returns an iterator for the entries in the map.
|
boolean |
equals(java.lang.Object obj) |
boolean |
equalsIdentity(java.lang.Object obj)
Uses == for comparison of each value.
|
K |
findKey(java.lang.Object value,
boolean identity)
Returns the key for the specified value, or null if it is not in the map.
|
V |
get(K key)
Returns the value (which may be null) for the specified key, or null if the key is not in the map.
|
V |
get(K key,
V defaultValue)
Returns the value (which may be null) for the specified key, or the default value if the key is not in the map.
|
ReadWriteLock |
getLock()
Returns the collection's
ReadWriteLock |
int |
getMaxCapacity()
Returns the maximum number of keys that can be stored in the
LruObjectMap |
int |
hashCode() |
boolean |
isEmpty()
Returns true if the map is empty.
|
org.mini2Dx.gdx.utils.ObjectMap.Keys<K> |
keys()
Returns an iterator for the keys in the map.
|
boolean |
notEmpty()
Returns true if the map has one or more items.
|
V |
put(K key,
V value)
Returns the old value associated with the specified key, or null.
|
void |
putAll(org.mini2Dx.gdx.utils.ObjectMap<? extends K,? extends V> map) |
V |
remove(K key)
Returns the value associated with the key, or null.
|
void |
shrink(int maximumCapacity)
Reduces the size of the backing arrays to be the specified capacity or less.
|
java.lang.String |
toString() |
java.lang.String |
toString(java.lang.String separator) |
org.mini2Dx.gdx.utils.ObjectMap.Values<V> |
values()
Returns an iterator for the values in the map.
|
protected ReadWriteLock lock
public ConcurrentLruObjectMap()
public ConcurrentLruObjectMap(int initialCapacity)
public ConcurrentLruObjectMap(int initialCapacity, float loadFactor)
public ConcurrentLruObjectMap(org.mini2Dx.gdx.utils.ObjectMap<? extends K,? extends V> map)
map
- public ConcurrentLruObjectMap(int initialCapacity, int maxCapacity)
public ConcurrentLruObjectMap(int initialCapacity, int maxCapacity, float loadFactor)
public int getMaxCapacity()
LruObjectMap
LruObjectMap
getMaxCapacity
in class LruObjectMap<K,V>
public V put(K key, V value)
put
in class LruObjectMap<K,V>
key
- value
- public void putAll(org.mini2Dx.gdx.utils.ObjectMap<? extends K,? extends V> map)
putAll
in class LruObjectMap<K,V>
public V get(K key)
get
in class LruObjectMap<K,V>
key
- public V get(K key, V defaultValue)
get
in class LruObjectMap<K,V>
key
- defaultValue
- public V remove(K key)
remove
in class LruObjectMap<K,V>
key
- public boolean notEmpty()
public boolean isEmpty()
public void shrink(int maximumCapacity)
public void clear(int maximumCapacity)
public void clear()
clear(int)
can be used to reduce the capacity.clear
in class LruObjectMap<K,V>
public boolean containsValue(java.lang.Object value, boolean identity)
containsValue
in class org.mini2Dx.gdx.utils.ObjectMap<K,V>
value
- identity
- If true, uses == to compare the specified value with values in the map. If false, uses
equals(Object)
.public boolean containsKey(K key)
public K findKey(java.lang.Object value, boolean identity)
findKey
in class org.mini2Dx.gdx.utils.ObjectMap<K,V>
value
- identity
- If true, uses == to compare the specified value with values in the map. If false, uses
equals(Object)
.public void ensureCapacity(int additionalCapacity)
public boolean equals(java.lang.Object obj)
public boolean equalsIdentity(java.lang.Object obj)
public java.lang.String toString(java.lang.String separator)
public java.lang.String toString()
public org.mini2Dx.gdx.utils.ObjectMap.Keys<K> keys()
public org.mini2Dx.gdx.utils.ObjectMap.Entries<K,V> entries()
public org.mini2Dx.gdx.utils.ObjectMap.Values<V> values()
public ReadWriteLock getLock()
ConcurrentCollection
ReadWriteLock
getLock
in interface ConcurrentCollection
ReadWriteLock