| Modifier and Type | Class and Description |
|---|---|
| private static interface | |
| private abstract static class |
| Modifier and Type | Field and Description |
|---|---|
| private final ConcurrentHashMap | |
| private final ReferenceQueue |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public V | Returns: the current (existing or computed) value associated with the specified key pair, or null if the computed value is nullthe 1st of the pair of keys with which the
computed value is to be associated k1, K2 the 2nd of the pair of keys with which the
computed value is to be associated k2, BiFunction<? super K1, ? super K2, ? extends V> the function to compute a value mappingFunction)If the specified key pair is not already associated with a value,
attempts to compute its value using the given mapping function
and enters it into this WeakPairMap unless |
| public boolean | Returns: true if and only if the specified key pair is in this WeakPairMap, as determined by the identity comparison; false otherwisethe 1st of the pair of keys k1, K2 the 2nd of the pair of keys k2)Tests if the specified pair of keys are associated with a value in the WeakPairMap. |
| private void | expungeStaleAssociations()
Removes associations from this WeakPairMap for which at least one of the keys in key pair has been found weakly-reachable and corresponding WeakRefPeer(s) enqueued. |
| public V | Returns: the value to which the specified key pair is mapped, or null if this map contains no mapping for the key pairthe 1st of the pair of keys for which the mapped value is to
be returned k1, K2 the 2nd of the pair of keys for which the mapped value is to
be returned k2)Returns the value to which the specified pair of keys is mapped, or null if this WeakPairMap contains no mapping for the key pair. |
| public V | Returns: the previous value associated with key pair, ornull if
there was no mapping for key pairthe 1st of the pair of keys with which the specified value is to
be associated k1, K2 the 2nd of the pair of keys with which the specified value is to
be associated k2, V value to be associated with the specified key pair v)Maps the specified key pair to the specified value in this WeakPairMap. |
| public V | Returns: the previous value associated with key pair, ornull if
there was no mapping for key pairthe 1st of the pair of keys with which the specified value is to
be associated k1, K2 the 2nd of the pair of keys with which the specified value is to
be associated k2, V value to be associated with the specified key pair v)If the specified key pair is not already associated with a value,
associates it with the given value and returns |
| public Collection | Returns: the collection viewReturns a |
| map | back to summary |
|---|---|
| private final ConcurrentHashMap<WeakPairMap. | |
| queue | back to summary |
|---|---|
| private final ReferenceQueue<Object> queue | |
| WeakPairMap | back to summary |
|---|---|
| pack-priv WeakPairMap() | |
| computeIfAbsent | back to summary |
|---|---|
| public V computeIfAbsent(K1 k1, K2 k2, BiFunction<? super K1, ? super K2, ? extends V> mappingFunction) If the specified key pair is not already associated with a value,
attempts to compute its value using the given mapping function
and enters it into this WeakPairMap unless
| |
| containsKeyPair | back to summary |
|---|---|
| public boolean containsKeyPair(K1 k1, K2 k2) Tests if the specified pair of keys are associated with a value in the WeakPairMap.
| |
| expungeStaleAssociations | back to summary |
|---|---|
| private void expungeStaleAssociations() Removes associations from this WeakPairMap for which at least one of the keys in key pair has been found weakly-reachable and corresponding WeakRefPeer(s) enqueued. Called as part of each public operation. | |
| get | back to summary |
|---|---|
| public V get(K1 k1, K2 k2) Returns the value to which the specified pair of keys is mapped, or null if this WeakPairMap contains no mapping for the key pair. More formally, if this WeakPairMap contains a mapping from a key pair
| |
| put | back to summary |
|---|---|
| public V put(K1 k1, K2 k2, V v) Maps the specified key pair to the specified value in this WeakPairMap. Neither the keys nor the value can be null. The value can be retrieved by calling the
| |
| putIfAbsent | back to summary |
|---|---|
| public V putIfAbsent(K1 k1, K2 k2, V v) If the specified key pair is not already associated with a value,
associates it with the given value and returns
| |
| values | back to summary |
|---|---|
| public Collection Returns a
| |
| Modifier and Type | Class and Description |
|---|---|
| public static class | WeakPairMap.
Optimized lookup Pair, used as lookup key in methods like
|
| public static class |
| Modifier and Type | Method and Description |
|---|---|
| public static boolean | |
| public K1 | |
| public static int | |
| public static <K1, K2> WeakPairMap. | |
| public K2 | |
| public static <K1, K2> WeakPairMap. |
| equals | back to summary |
|---|---|
| public static boolean equals(Object first, Object second, WeakPairMap. | |
| first | back to summary |
|---|---|
public K1 first()
| |
| hashCode | back to summary |
|---|---|
| public static int hashCode(Object first, Object second) | |
| lookup | back to summary |
|---|---|
| public static <K1, K2> WeakPairMap. | |
| second | back to summary |
|---|---|
public K2 second()
| |
| weak | back to summary |
|---|---|
| public static <K1, K2> WeakPairMap. | |
java.util.Map#get(Object) or
java.util.Map#containsKey(Object) ) where
there is a great chance its allocation is eliminated
by escape analysis when such lookups are inlined by JIT.
All its methods are purposely designed so that 'this' is never
passed to any other method or used as identity.
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | equals(Object obj)
Overrides java. Indicates whether some other object is "equal to" this one. |
| public K1 | |
| public int | |
| public K2 |
| Lookup | back to summary |
|---|---|
| pack-priv Lookup(K1 k1, K2 k2) | |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.
| |
| first | back to summary |
|---|---|
| public K1 first() Implements java.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| second | back to summary |
|---|---|
| public K2 second() Implements java.
| |
WeakRefPeers:
+-referent-> [K1] +-referent-> [K2]
| |
+----------------+ +----------------+
| Pair.Weak <: |-----peer----->| (anonymous) <: |
| WeakRefPeer, | | WeakRefPeer |
| Pair |<--weakPair()--| |
+----------------+ +----------------+
| ^
| |
+-weakPair()-+
Pair.Weak is used for CHM keys. Both peers are associated with the
same ReferenceQueue so when either of their referents
becomes weakly-reachable, the corresponding entries can be
expunged from the map.
| Modifier and Type | Field and Description |
|---|---|
| private final int | |
| private final WeakPairMap. |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | equals(Object obj)
Overrides java. Indicates whether some other object is "equal to" this one. |
| public K1 | |
| public int | |
| public K2 | |
| pack-priv WeakPairMap. |
| hash | back to summary |
|---|---|
| private final int hash | |
| peer | back to summary |
|---|---|
| private final WeakPairMap. | |
| Weak | back to summary |
|---|---|
| pack-priv Weak(K1 k1, K2 k2, ReferenceQueue<Object> queue) | |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.
| |
| first | back to summary |
|---|---|
| public K1 first() Implements java.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| second | back to summary |
|---|---|
| public K2 second() Implements java.
| |
| weakPair | back to summary |
|---|---|
| pack-priv WeakPairMap. Implements abstract java.
| |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv abstract WeakPairMap. |
| WeakRefPeer | back to summary |
|---|---|
| pack-priv WeakRefPeer(K k, ReferenceQueue<Object> queue) | |
| weakPair | back to summary |
|---|---|
pack-priv abstract WeakPairMap.
| |