public class ConcurrentOrderedMap<K,V> extends org.mini2Dx.gdx.utils.OrderedMap<K,V> implements ConcurrentCollection
Modifier and Type | Field and Description |
---|---|
protected ReadWriteLock |
lock |
Constructor and Description |
---|
ConcurrentOrderedMap()
Creates a new map with an initial capacity of 51 and a load factor of 0.8.
|
ConcurrentOrderedMap(int initialCapacity)
Creates a new map with a load factor of 0.8.
|
ConcurrentOrderedMap(int initialCapacity,
float loadFactor)
Creates a new map with the specified initial capacity and load factor.
|
ConcurrentOrderedMap(org.mini2Dx.gdx.utils.OrderedMap<? extends K,? extends V> map)
Creates a new map identical to the specified map.
|
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 |
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.
|
org.mini2Dx.gdx.utils.Array<K> |
orderedKeys() |
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.
|
V |
removeIndex(int index) |
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 ConcurrentOrderedMap()
public ConcurrentOrderedMap(int initialCapacity)
initialCapacity
- If not a power of two, it is increased to the next nearest power of two.public ConcurrentOrderedMap(int initialCapacity, float loadFactor)
initialCapacity
- If not a power of two, it is increased to the next nearest power of two.loadFactor
- public V get(K key)
public V get(K key, V defaultValue)
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.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 V removeIndex(int index)
public org.mini2Dx.gdx.utils.Array<K> orderedKeys()
public org.mini2Dx.gdx.utils.ObjectMap.Keys<K> keys()
If Collections.allocateIterators
is false, the same iterator instance is returned each time this method is called. Use the
OrderedMapKeys
constructor for nested or multithreaded iteration.
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.Entries<K,V> entries()
public org.mini2Dx.gdx.utils.ObjectMap.Values<V> values()
public ReadWriteLock getLock()
ConcurrentCollection
ReadWriteLock
getLock
in interface ConcurrentCollection
ReadWriteLock