public class ObjectMap<K,V> extends java.lang.Object implements java.lang.Iterable<ObjectMap.Entry<K,V>>
限定符和类型 | 类和说明 |
---|---|
static class |
ObjectMap.Entries<K,V> |
static class |
ObjectMap.Entry<K,V> |
static class |
ObjectMap.Keys<K> |
static class |
ObjectMap.Values<V> |
限定符和类型 | 字段和说明 |
---|---|
int |
size |
构造器和说明 |
---|
ObjectMap()
Creates a new map with an initial capacity of 51 and a load factor of 0.8.
|
ObjectMap(int initialCapacity)
Creates a new map with a load factor of 0.8.
|
ObjectMap(int initialCapacity,
float loadFactor)
Creates a new map with the specified initial capacity and load factor.
|
ObjectMap(ObjectMap<? extends K,? extends V> map)
Creates a new map identical to the specified map.
|
限定符和类型 | 方法和说明 |
---|---|
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(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.
|
ObjectMap.Entries<K,V> |
entries()
Returns an iterator for the entries in the map.
|
boolean |
equals(java.lang.Object obj) |
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) |
V |
get(K key,
V defaultValue)
Returns the value for the specified key, or the default value if the key is not in the map.
|
int |
hashCode() |
ObjectMap.Entries<K,V> |
iterator() |
ObjectMap.Keys<K> |
keys()
Returns an iterator for the keys in the map.
|
V |
put(K key,
V value)
Returns the old value associated with the specified key, or null.
|
void |
putAll(ObjectMap<K,V> map) |
V |
remove(K key) |
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) |
ObjectMap.Values<V> |
values()
Returns an iterator for the values in the map.
|
public ObjectMap()
public ObjectMap(int initialCapacity)
initialCapacity
- If not a power of two, it is increased to the next nearest power of two.public ObjectMap(int initialCapacity, float loadFactor)
initialCapacity
- If not a power of two, it is increased to the next nearest power of two.public V get(K key, V defaultValue)
public void shrink(int maximumCapacity)
public void clear(int maximumCapacity)
public void clear()
public boolean containsValue(java.lang.Object value, boolean identity)
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)
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 int hashCode()
hashCode
在类中 java.lang.Object
public boolean equals(java.lang.Object obj)
equals
在类中 java.lang.Object
public java.lang.String toString(java.lang.String separator)
public java.lang.String toString()
toString
在类中 java.lang.Object
public ObjectMap.Entries<K,V> iterator()
iterator
在接口中 java.lang.Iterable<ObjectMap.Entry<K,V>>
public ObjectMap.Entries<K,V> entries()
ObjectMap.Entries
constructor for nested or multithreaded iteration.public ObjectMap.Values<V> values()
ObjectMap.Values
constructor for nested or multithreaded iteration.public ObjectMap.Keys<K> keys()
ObjectMap.Keys
constructor for nested or multithreaded iteration.