public class ConcurrentObjectIntMap<K> extends org.mini2Dx.gdx.utils.ObjectIntMap<K> implements ConcurrentCollection
Modifier and Type | Field and Description |
---|---|
protected ReadWriteLock |
lock |
Constructor and Description |
---|
ConcurrentObjectIntMap()
Creates a new map with an initial capacity of 51 and a load factor of 0.8.
|
ConcurrentObjectIntMap(int initialCapacity)
Creates a new map with a load factor of 0.8.
|
ConcurrentObjectIntMap(int initialCapacity,
float loadFactor)
Creates a new map with the specified initial capacity and load factor.
|
ConcurrentObjectIntMap(org.mini2Dx.gdx.utils.ObjectIntMap<? extends K> 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(int value)
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.ObjectIntMap.Entries<K> |
entries()
Returns an iterator for the entries in the map.
|
boolean |
equals(java.lang.Object obj) |
K |
findKey(int value)
Returns the key for the specified value, or null if it is not in the map.
|
int |
get(K key,
int defaultValue)
Returns the value (which may be null) for the specified key, or the default value if the key is not in the map.
|
int |
getAndIncrement(K key,
int defaultValue,
int increment)
Returns the key's current value and increments the stored value.
|
ReadWriteLock |
getLock()
Returns the collection's
ReadWriteLock |
int |
hashCode() |
boolean |
isEmpty()
Returns true if the map is empty.
|
org.mini2Dx.gdx.utils.ObjectIntMap.Keys<K> |
keys()
Returns an iterator for the keys in the map.
|
boolean |
notEmpty()
Returns true if the map has one or more items.
|
void |
put(K key,
int value)
Returns the old value associated with the specified key, or null.
|
void |
putAll(org.mini2Dx.gdx.utils.ObjectIntMap<? extends K> map) |
int |
remove(K key,
int defaultValue) |
void |
shrink(int maximumCapacity)
Reduces the size of the backing arrays to be the specified capacity or less.
|
java.lang.String |
toString() |
org.mini2Dx.gdx.utils.ObjectIntMap.Values |
values()
Returns an iterator for the values in the map.
|
protected ReadWriteLock lock
public ConcurrentObjectIntMap()
public ConcurrentObjectIntMap(int initialCapacity)
initialCapacity
- If not a power of two, it is increased to the next nearest power of two.public ConcurrentObjectIntMap(int initialCapacity, float loadFactor)
initialCapacity
- If not a power of two, it is increased to the next nearest power of two.loadFactor
- public ConcurrentObjectIntMap(org.mini2Dx.gdx.utils.ObjectIntMap<? extends K> map)
map
- public void put(K key, int value)
put
in class org.mini2Dx.gdx.utils.ObjectIntMap<K>
key
- value
- public void putAll(org.mini2Dx.gdx.utils.ObjectIntMap<? extends K> map)
putAll
in class org.mini2Dx.gdx.utils.ObjectIntMap<K>
public int get(K key, int defaultValue)
get
in class org.mini2Dx.gdx.utils.ObjectIntMap<K>
key
- defaultValue
- public boolean notEmpty()
notEmpty
in class org.mini2Dx.gdx.utils.ObjectIntMap<K>
public boolean isEmpty()
isEmpty
in class org.mini2Dx.gdx.utils.ObjectIntMap<K>
public void shrink(int maximumCapacity)
shrink
in class org.mini2Dx.gdx.utils.ObjectIntMap<K>
maximumCapacity
- public void clear(int maximumCapacity)
clear
in class org.mini2Dx.gdx.utils.ObjectIntMap<K>
maximumCapacity
- public void clear()
clear(int)
can be used to reduce the capacity.clear
in class org.mini2Dx.gdx.utils.ObjectIntMap<K>
public boolean containsKey(K key)
containsKey
in class org.mini2Dx.gdx.utils.ObjectIntMap<K>
public void ensureCapacity(int additionalCapacity)
ensureCapacity
in class org.mini2Dx.gdx.utils.ObjectIntMap<K>
additionalCapacity
- public int getAndIncrement(K key, int defaultValue, int increment)
getAndIncrement
in class org.mini2Dx.gdx.utils.ObjectIntMap<K>
key
- defaultValue
- increment
- public int remove(K key, int defaultValue)
remove
in class org.mini2Dx.gdx.utils.ObjectIntMap<K>
public boolean containsValue(int value)
containsValue
in class org.mini2Dx.gdx.utils.ObjectIntMap<K>
value
- public K findKey(int value)
findKey
in class org.mini2Dx.gdx.utils.ObjectIntMap<K>
value
- public int hashCode()
hashCode
in class org.mini2Dx.gdx.utils.ObjectIntMap<K>
public boolean equals(java.lang.Object obj)
equals
in class org.mini2Dx.gdx.utils.ObjectIntMap<K>
public java.lang.String toString()
toString
in class org.mini2Dx.gdx.utils.ObjectIntMap<K>
public org.mini2Dx.gdx.utils.ObjectIntMap.Keys<K> keys()
If Collections.allocateIterators
is false, the same iterator instance is returned each time this method is called. Use the
Entries
constructor for nested or multithreaded iteration.
keys
in class org.mini2Dx.gdx.utils.ObjectIntMap<K>
public org.mini2Dx.gdx.utils.ObjectIntMap.Entries<K> entries()
entries
in class org.mini2Dx.gdx.utils.ObjectIntMap<K>
public org.mini2Dx.gdx.utils.ObjectIntMap.Values values()
values
in class org.mini2Dx.gdx.utils.ObjectIntMap<K>
public ReadWriteLock getLock()
ConcurrentCollection
ReadWriteLock
getLock
in interface ConcurrentCollection
ReadWriteLock