V
- valuepublic class TypedIdentityMap<V> extends Object implements ConcurrentMap<Key<? extends V>,V>
Key
instance without having to cast from Key
is lost. See WeakHashMap
.
Example:
TypedIdentityMap<Object> map = new TypedIdentityMap<Object>();
Key<Foo> fooKey = Key.create(Foo.class);
map.putIfAbsent(fooKey, new Foo());
Foo foo = map.getValue(fooKey);Constructor and Description |
---|
TypedIdentityMap() |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
Set<Map.Entry<Key<? extends V>,V>> |
entrySet() |
boolean |
equals(Object o) |
V |
get(Object key) |
<T extends V> |
getValue(Key<? extends V> key)
Retrieves the value represented by
Key in a type safe manner. |
int |
hashCode() |
boolean |
isEmpty() |
Set<Key<? extends V>> |
keySet() |
V |
put(Key<? extends V> key,
V value) |
void |
putAll(Map<? extends Key<? extends V>,? extends V> m) |
V |
putIfAbsent(Key<? extends V> key,
V value) |
V |
remove(Object key) |
boolean |
remove(Object key,
Object value) |
V |
replace(Key<? extends V> key,
V value) |
boolean |
replace(Key<? extends V> key,
V oldValue,
V newValue) |
int |
size() |
Collection<V> |
values() |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, replaceAll
@Nullable public <T extends V> T getValue(Key<? extends V> key)
Key
in a type safe manner.T
- key
- public boolean equals(Object o)
public int hashCode()
public V putIfAbsent(Key<? extends V> key, V value)
putIfAbsent
in interface ConcurrentMap<Key<? extends V>,V>
putIfAbsent
in interface Map<Key<? extends V>,V>
public boolean containsKey(Object key)
containsKey
in interface Map<Key<? extends V>,V>
public boolean containsValue(Object value)
containsValue
in interface Map<Key<? extends V>,V>
Copyright © 2022 Atlassian Software Systems Pty Ltd. All rights reserved.