Package org.jruby.util
Class WeakIdentityHashMap
java.lang.Object
org.jruby.util.GenericMap
org.jruby.util.WeakIdentityHashMap
- All Implemented Interfaces:
Map
Class
WeakIdentityHashMap
is a hash map that hashes
objects based on System.identityHashMap, and holds weakly onto the
key. This fails if values make reference to the keys!- Since:
- 1.0
- Version:
- 2.0
- Author:
- Kresten Krab Thorup
-
Field Summary
Fields inherited from class org.jruby.util.GenericMap
size
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
boolean
containsKey
(Object key) return the element with the given keyprotected Iterator
return the element with the given keyboolean
isEmpty()
protected final boolean
protected final int
int
size()
protected void
valueRemoved
(Object value) Methods inherited from class org.jruby.util.GenericMap
containsValue, entrySet, equals, hashCode, keyIterator, keySet, putAll, valueEquals, valueHash, valueIterator, values
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, containsValue, entrySet, equals, forEach, getOrDefault, hashCode, keySet, merge, putAll, putIfAbsent, remove, replace, replace, replaceAll, values
-
Constructor Details
-
WeakIdentityHashMap
public WeakIdentityHashMap()the default and only constructor -
WeakIdentityHashMap
public WeakIdentityHashMap(int size)
-
-
Method Details
-
clear
public void clear() -
get
return the element with the given key -
containsKey
return the element with the given key- Specified by:
containsKey
in interfaceMap
- Overrides:
containsKey
in classGenericMap
-
put
-
remove
-
remove
-
valueRemoved
-
entryIterator
- Specified by:
entryIterator
in classGenericMap
-
keyHash
- Overrides:
keyHash
in classGenericMap
-
keyEquals
- Overrides:
keyEquals
in classGenericMap
-
size
public int size()- Specified by:
size
in interfaceMap
- Overrides:
size
in classGenericMap
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceMap
- Overrides:
isEmpty
in classGenericMap
-