public class ConcurrentShortMap<T> extends ShortMap<T> implements ConcurrentCollection
ShortMap.Entries<V>, ShortMap.Entry<V>, ShortMap.Keys, ShortMap.Values<V>| Modifier and Type | Field and Description |
|---|---|
protected org.mini2Dx.lockprovider.ReadWriteLock |
lock |
| Constructor and Description |
|---|
ConcurrentShortMap() |
ConcurrentShortMap(int initialCapacity) |
ConcurrentShortMap(int initialCapacity,
float loadFactor) |
ConcurrentShortMap(ShortMap<? extends T> map)
NOTE: read access to the other map is not thread-safe
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
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(short 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.
|
ShortMap.Entries<T> |
entries()
Returns an iterator for the entries in the map.
|
boolean |
equals(java.lang.Object object) |
short |
findKey(java.lang.Object value,
boolean identity,
short notFound)
Returns the key for the specified value, or
notFound if it is not in the map. |
T |
get(short key,
T defaultValue) |
org.mini2Dx.lockprovider.ReadWriteLock |
getLock()
Returns the collection's
ReadWriteLock |
int |
hashCode() |
ShortMap.Keys |
keys()
Returns an iterator for the keys in the map.
|
T |
put(short key,
T value) |
void |
putAll(ShortMap<T> map) |
boolean |
putIfAbsent(short key,
T value)
Puts a key/value if the key is not already present
|
boolean |
putIfPresent(short key,
T value)
Puts a key/value if the key is already present
|
T |
remove(short key) |
void |
shrink(int maximumCapacity)
Reduces the size of the backing arrays to be the specified capacity or less.
|
int |
size()
Returns the size in a thread-safe manner
|
java.lang.String |
toString() |
ShortMap.Values<T> |
values()
Returns an iterator for the values in the map.
|
public ConcurrentShortMap()
public ConcurrentShortMap(int initialCapacity)
public ConcurrentShortMap(int initialCapacity,
float loadFactor)
public int size()
public boolean putIfAbsent(short key,
T value)
key - The key to put if absentvalue - The value to put if absentpublic boolean putIfPresent(short key,
T value)
key - The key to put if presentvalue - The value to put if presentpublic void shrink(int maximumCapacity)
ShortMappublic void clear(int maximumCapacity)
ShortMappublic boolean containsValue(java.lang.Object value,
boolean identity)
ShortMapcontainsValue in class ShortMap<T>public boolean containsKey(short key)
containsKey in class ShortMap<T>public short findKey(java.lang.Object value,
boolean identity,
short notFound)
ShortMapnotFound if it is not in the map. Note this traverses the entire map
and compares every value, which may be an expensive operation.findKey in class ShortMap<T>identity - If true, uses == to compare the specified value with values in the map. If false, uses
ShortMap.equals(Object).public void ensureCapacity(int additionalCapacity)
ShortMapensureCapacity in class ShortMap<T>public ShortMap.Entries<T> entries()
ShortMapShortMap.Entries constructor for nested or multithreaded iteration.public ShortMap.Values<T> values()
ShortMapShortMap.Entries constructor for nested or multithreaded iteration.public ShortMap.Keys keys()
ShortMapShortMap.Entries constructor for nested or multithreaded iteration.public org.mini2Dx.lockprovider.ReadWriteLock getLock()
ConcurrentCollectionReadWriteLockgetLock in interface ConcurrentCollectionReadWriteLock