public class TLcdWeakIdentityHashMap<K,V> extends Object implements Map<K,V>, ILcdCloneable
WeakHashMap
for a more detailed discussion.Constructor and Description |
---|
TLcdWeakIdentityHashMap()
Creates a new map with an initial capacity of 16 and load factor of 0.75.
|
TLcdWeakIdentityHashMap(int aInitialCapacity)
Creates a new map with the given initial capacity and load factor of 0.75.
|
TLcdWeakIdentityHashMap(int aInitialCapacity,
float aLoadFactor)
Creates a new map with the given initial capacity and the given load factor.
|
TLcdWeakIdentityHashMap(Map aMap)
Creates a new map containing all entries in the given map.
|
Modifier and Type | Method and Description |
---|---|
void |
clear() |
Object |
clone()
Makes
Object.clone() public. |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
Set<Map.Entry<K,V>> |
entrySet() |
V |
get(Object key) |
boolean |
isEmpty() |
Set<K> |
keySet() |
protected void |
onRemove(Object aKey,
V aValue)
Called when an entry is removed from the map (either by explicitly removing it,
when it's overridden, or when it was removed because it was unreferenced)
|
V |
put(K key,
V value) |
void |
putAll(Map<? extends K,? extends V> t) |
V |
remove(Object key) |
int |
size() |
String |
toString() |
Collection<V> |
values() |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
public TLcdWeakIdentityHashMap()
public TLcdWeakIdentityHashMap(int aInitialCapacity)
aInitialCapacity
- the initial capacity of the mappublic TLcdWeakIdentityHashMap(int aInitialCapacity, float aLoadFactor)
aInitialCapacity
- the initial capacity of the mapaLoadFactor
- the load factorHashMap
public TLcdWeakIdentityHashMap(Map aMap)
put(k, v)
on this map once for each mapping
from key k to value v in the specified map.aMap
- the map whose entries to load into this map.HashMap
protected void onRemove(Object aKey, V aValue)
aKey
- the key. Can be null
if it was unreferenced (when not hard-referenced anymore).aValue
- the valuepublic Set<Map.Entry<K,V>> entrySet()
It is not allowed to access the map (for example calling get
) while iterating over
the result of this method, except via the Iterator.remove
method. Not doing so may lead to
ConcurrentModificationException
s in rare cases.
public Set<K> keySet()
It is not allowed to access the map (for example calling get
) while iterating over
the result of this method, except via the Iterator.remove
method. Not doing so may lead to
ConcurrentModificationException
s in rare cases.
public boolean containsKey(Object key)
containsKey
in interface Map<K,V>
public boolean containsValue(Object value)
containsValue
in interface Map<K,V>
public Object clone()
ILcdCloneable
Makes Object.clone()
public.
java.lang.Object
, it can be implemented like this:
public Object clone() {
try {
return super.clone();
} catch ( CloneNotSupportedException e ) {
// Cannot happen: extends from Object and implements Cloneable (see also Object.clone)
throw new RuntimeException( e );
}
}
clone
in interface ILcdCloneable
clone
in class Object
Object.clone()