public class IdentityMap<K,V>
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
IdentityMap.Entries<K,V> |
static class |
IdentityMap.Entry<K,V> |
static class |
IdentityMap.Keys<K> |
static class |
IdentityMap.Values<V> |
Modifier and Type | Field and Description |
---|---|
int |
size |
Constructor and Description |
---|
IdentityMap()
Creates a new map with an initial capacity of 32 and a load factor of 0.8.
|
IdentityMap(int initialCapacity)
Creates a new map with a load factor of 0.8.
|
IdentityMap(int initialCapacity,
float loadFactor)
Creates a new map with the specified initial capacity and load factor.
|
Modifier and Type | Method and Description |
---|---|
void |
clear() |
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 acommodate the specified number of additional items.
|
IdentityMap.Entries<K,V> |
entries()
Returns an iterator for the entries in the map.
|
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) |
IdentityMap.Keys<K> |
keys()
Returns an iterator for the keys in the map.
|
V |
put(K key,
V value) |
V |
remove(K key) |
java.lang.String |
toString() |
IdentityMap.Values<V> |
values()
Returns an iterator for the values in the map.
|
public IdentityMap()
public IdentityMap(int initialCapacity)
public IdentityMap(int initialCapacity, float loadFactor)
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
Object.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
Object.equals(Object)
.public void ensureCapacity(int additionalCapacity)
public java.lang.String toString()
toString
in class java.lang.Object
public IdentityMap.Entries<K,V> entries()
IdentityMap.Entries
constructor for nested or multithreaded iteration.public IdentityMap.Values<V> values()
IdentityMap.Entries
constructor for nested or multithreaded iteration.public IdentityMap.Keys<K> keys()
IdentityMap.Entries
constructor for nested or multithreaded iteration.