Map interface because
this implementation is incompatible with the map contract. While iterating over a map's entries,
any key that has not passed iteration is referenced non-weakly.
This class has been copied as is from https://github.com/raphw/weak-lock-free/blob/ad0e5e0c04d4a31f9485bf12b89afbc9d75473b3/src/main/java/com/blogspot/mydailyjava/weaklockfree/WeakConcurrentMap.java
This class is internal and is hence not for public use. Its APIs are unstable and can change at any time.
| Modifier and Type | Class and Description |
|---|---|
| private class | |
| private class | |
| public static class |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final ConcurrentMap |
| Access | Constructor and Description |
|---|---|
| protected | |
| protected | AbstractWeakConcurrentMap(ConcurrentMap<AbstractWeakConcurrentMap.
ConcurrentMap implementation that this class wraps. target
|
| Modifier and Type | Method and Description |
|---|---|
| public int | Returns: The minimum size of this map.Returns the approximate size of this map where the returned number is at least as big as the actual number of entries. |
| public void | |
| public boolean | |
| protected V | Returns: The default value for a key without value ornull for not defining a default
value.The key for which to create a default value. key)Creates a default value. |
| public void | |
| public V | Returns: The value of the entry or the default value if it did not exist.The key of the entry. key)
|
| public V | Returns: The value of the entry or null if it did not exist.The key of the entry. key)
|
| protected abstract L | |
| public Iterator | |
| public V | Returns: The previous entry ornull if it does not exist.The key of the entry. key, V The value of the entry. value)
|
| public V | Returns: The previous entry ornull if it does not exist.The key of the entry. key, V The value of the entry. value)
|
| public V | Returns: The previous entry ornull if it does not exist.The key of the entry. key, V The value of the entry. value)
|
| public V | |
| protected abstract void | |
| public void | |
| public String |
| target | back to summary |
|---|---|
| pack-priv final ConcurrentMap<AbstractWeakConcurrentMap. | |
| AbstractWeakConcurrentMap | back to summary |
|---|---|
| protected AbstractWeakConcurrentMap() | |
| AbstractWeakConcurrentMap | back to summary |
|---|---|
protected AbstractWeakConcurrentMap(ConcurrentMap<AbstractWeakConcurrentMap.
| |
| approximateSize | back to summary |
|---|---|
| public int approximateSize() Returns the approximate size of this map where the returned number is at least as big as the actual number of entries.
| |
| clear | back to summary |
|---|---|
| public void clear() Clears the entire map. | |
| containsKey | back to summary |
|---|---|
public boolean containsKey(K key)
| |
| defaultValue | back to summary |
|---|---|
| protected V defaultValue(K key) Creates a default value. There is no guarantee that the requested value will be set as a once it is created in case that another thread requests a value for a key concurrently.
| |
| expungeStaleEntries | back to summary |
|---|---|
| public void expungeStaleEntries() Cleans all unused references. | |
| get | back to summary |
|---|---|
public V get(K key)
| |
| getIfPresent | back to summary |
|---|---|
public V getIfPresent(K key)
| |
| getLookupKey | back to summary |
|---|---|
| protected abstract L getLookupKey(K key) Override with care as it can cause lookup failures if done incorrectly. The result must have
the same | |
| iterator | back to summary |
|---|---|
| public Iterator Implements java. Doc from java. Returns an iterator over elements of type | |
| put | back to summary |
|---|---|
public V put(K key, V value)
| |
| putIfAbsent | back to summary |
|---|---|
public V putIfAbsent(K key, V value)
| |
| putIfProbablyAbsent | back to summary |
|---|---|
public V putIfProbablyAbsent(K key, V value)
| |
| remove | back to summary |
|---|---|
public V remove(K key)
| |
| resetLookupKey | back to summary |
|---|---|
| protected abstract void resetLookupKey(L lookupKey) Resets any reusable state in the lookup key. | |
| run | back to summary |
|---|---|
| public void run() Implements java. Doc from java. Runs this operation.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |
| Modifier and Type | Field and Description |
|---|---|
| private final Iterator | |
| private Map. | |
| private K |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| public boolean | |
| public Map. | |
| public void | remove()
Overrides default java. Removes from the underlying collection the last element returned by this iterator (optional operation). |
| iterator | back to summary |
|---|---|
| private final Iterator<Map. | |
| nextEntry | back to summary |
|---|---|
| private Map. | |
| nextKey | back to summary |
|---|---|
| private K nextKey | |
| EntryIterator | back to summary |
|---|---|
| private EntryIterator(Iterator<Map. | |
| findNext | back to summary |
|---|---|
| private void findNext() | |
| hasNext | back to summary |
|---|---|
| public boolean hasNext() Implements java. Doc from java. Returns
| |
| next | back to summary |
|---|---|
| public Map. Implements java. Doc from java. Returns the next element in the iteration. | |
| remove | back to summary |
|---|---|
| public void remove() Overrides default java. Doc from java. Removes from the underlying collection the last element returned
by this iterator (optional operation). This method can be called
only once per call to The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.
The behavior of an iterator is unspecified if this method is called
after a call to the
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final Map. | |
| private final K |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public K | |
| public V | |
| public V | setValue(V
new value to be stored in this entry value)Implements java. Replaces the value corresponding to this entry with the specified value (optional operation). |
| entry | back to summary |
|---|---|
| pack-priv final Map. | |
| key | back to summary |
|---|---|
| private final K key | |
| SimpleEntry | back to summary |
|---|---|
| private SimpleEntry(K key, Map. | |
| getKey | back to summary |
|---|---|
| public K getKey() Implements java. Doc from java. Returns the key corresponding to this entry.
| |
| getValue | back to summary |
|---|---|
| public V getValue() Implements java. Doc from java. Returns the value corresponding to this entry. If the mapping
has been removed from the backing map (by the iterator's
| |
| setValue | back to summary |
|---|---|
| public V setValue(V value) Implements java. Doc from java. Replaces the value corresponding to this entry with the specified
value (optional operation). (Writes through to the map.) The
behavior of this call is undefined if the mapping has already been
removed from the map (by the iterator's
| |
| Modifier and Type | Field and Description |
|---|---|
| private final int |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | equals(Object
the reference object with which to compare. other)Overrides java. Indicates whether some other object is "equal to" this one. |
| public int | |
| public String |
| hashCode | back to summary |
|---|---|
| private final int hashCode | |
| WeakKey | back to summary |
|---|---|
| pack-priv WeakKey(K key, ReferenceQueue<? super K> queue) | |
| equals | back to summary |
|---|---|
| public boolean equals(Object other) 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. | |
| 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
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |