public interface KeyFMap
Key
entries with relatively rare updates.
To construct a map, start with EMPTY_MAP
and call plus(com.intellij.openapi.util.Key<V>, V)
and minus(com.intellij.openapi.util.Key<?>)
.
The hashCode() contract conforms to the hashCode() contract of the Map
interface:
it's the sum of hash codes of its entries, which in turn is calculated as key.hashCode() ^ value.hashCode()
Modifier and Type | Field and Description |
---|---|
static KeyFMap |
EMPTY_MAP
An empty
KeyFMap . |
Modifier and Type | Method and Description |
---|---|
boolean |
equalsByReference(KeyFMap other)
Checks if other
KeyFMap equals to this, assuming reference equality for the values |
<V> V |
get(Key<V> key)
Returns a value associated with given key in this
KeyFMap , or null if no value is associated. |
Key [] |
getKeys() |
int |
getValueIdentityHashCode() |
boolean |
isEmpty() |
KeyFMap |
minus(Key<?> key)
Returns a KeyFMap which consists of the same elements as this KeyFMap, except
the supplied key which is removed.
|
<V> KeyFMap |
plus(Key<V> key,
V value)
Returns a
KeyFMap which consists of the same elements as this KeyFMap , but
the key key is associated with the supplied value . |
int |
size() |
static final KeyFMap EMPTY_MAP
KeyFMap
. No additional instances of empty KeyFMap
should be created as they are indistinguishable.<V> KeyFMap plus(Key<V> key, V value)
KeyFMap
which consists of the same elements as this KeyFMap
, but
the key key
is associated with the supplied value
. May return itself if the key
is already associated with the supplied value
.V
- a type of the valuekey
- a key to add or replacevalue
- a value to be associated with the keyKeyFMap
(this or newly created)KeyFMap minus(Key<?> key)
key
- a key to remove<V> V get(Key<V> key)
KeyFMap
, or null if no value is associated.
Note that unlike HashMap
KeyFMap
cannot hold null values.V
- a type of the valuekey
- a key to get the value associated withint size()
KeyFMap
.Key [] getKeys()
KeyFMap
, in no particular order. The length of the array equals to KeyFMap size.boolean isEmpty()
KeyFMap
is empty.int getValueIdentityHashCode()
System.identityHashCode(Object)
for values.boolean equalsByReference(KeyFMap other)
KeyFMap
equals to this, assuming reference equality for the valuesother
- KeyFMap
to compare with