public class ReadWriteIntMap<T> extends IntMap<T>
IntMap.Entries<V>, IntMap.Entry<V>, IntMap.Keys, IntMap.Values<V>| Modifier and Type | Field and Description |
|---|---|
protected org.mini2Dx.lockprovider.ReadWriteLock |
lock |
| Constructor and Description |
|---|
ReadWriteIntMap()
Creates a new map with an initial capacity of 51 and a load factor of 0.8.
|
ReadWriteIntMap(int initialCapacity)
Creates a new map with a load factor of 0.8.
|
ReadWriteIntMap(int initialCapacity,
float loadFactor)
Creates a new map with the specified initial capacity and load factor.
|
ReadWriteIntMap(IntMap<? extends T> map)
Creates a new map identical to the specified map.
|
| 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(int key) |
void |
ensureCapacity(int additionalCapacity)
Increases the size of the backing array to accommodate the specified number of additional items.
|
IntMap.Entries<T> |
entries() |
boolean |
equals(java.lang.Object obj) |
int |
findKey(java.lang.Object value,
boolean identity,
int notFound)
Returns the key for the specified value, or notFound if it is not in the map.
|
T |
get(int key) |
T |
get(int key,
T defaultValue) |
org.mini2Dx.lockprovider.ReadWriteLock |
getLock() |
int |
hashCode() |
boolean |
isEmpty()
Returns true if the map is empty.
|
IntMap.Keys |
keys() |
boolean |
notEmpty()
Returns true if the map has one or more items.
|
T |
put(int key,
T value) |
void |
putAll(IntMap<? extends T> map) |
boolean |
putIfAbsent(int key,
T value)
Puts a key/value if the key is not already present
|
boolean |
putIfPresent(int key,
T value)
Puts a key/value if the key is already present
|
T |
remove(int key)
Returns the value for the removed key, or null if the key is not in the map.
|
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() |
IntMap.Values<T> |
values() |
containsValue, equalsIdentity, iterator, placepublic ReadWriteIntMap()
public ReadWriteIntMap(int initialCapacity)
initialCapacity - If not a power of two, it is increased to the next nearest power of two.public ReadWriteIntMap(int initialCapacity,
float loadFactor)
initialCapacity - If not a power of two, it is increased to the next nearest power of two.loadFactor - public int size()
public boolean putIfAbsent(int key,
T value)
key - The key to put if absentvalue - The value to put if absentpublic boolean putIfPresent(int key,
T value)
key - The key to put if presentvalue - The value to put if presentpublic T remove(int key)
IntMappublic boolean notEmpty()
public boolean isEmpty()
public void shrink(int maximumCapacity)
public void clear(int maximumCapacity)
public boolean containsKey(int key)
containsKey in class IntMap<T>public int findKey(java.lang.Object value,
boolean identity,
int notFound)
findKey in class IntMap<T>value - identity - If true, uses == to compare the specified value with values in the map. If false, uses
equals(Object).notFound - public void ensureCapacity(int additionalCapacity)
ensureCapacity in class IntMap<T>additionalCapacity - public IntMap.Entries<T> entries()
public IntMap.Values<T> values()
public IntMap.Keys keys()
public org.mini2Dx.lockprovider.ReadWriteLock getLock()