public class WeakHashClockImpl<K,V> extends Object implements WeakHashClock<K,V>
Constructor and Description |
---|
WeakHashClockImpl(boolean isWeak) |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Sets the clock size back to zero, no entries
|
void |
clearStaleReferences()
Causes stale references to be cleared from the data
structures.
|
V |
get(K key)
Gets the given key, returning null
if not found
|
boolean |
hasWeakKeys()
Tells if this WeakHashClock has Weak keys
|
Map.Entry<K,V> |
next()
Returns the next key/value pair in the clock,
or null if the clock has no members.
|
void |
put(K key,
V value)
Adds the given pair to the clock.
|
void |
releaseMatching(CacheKeyFilter<K> filter)
Releases all key/value pairs that match the filter
|
V |
remove(K key)
Removes the given key from the clock, if found
|
int |
size()
Returns the number of elements currently
in the clock.
|
String |
toString() |
public void put(K key, V value)
WeakHashClock
put
in interface WeakHashClock<K,V>
key
- Must not be nullvalue
- May not be nullpublic V get(K key)
WeakHashClock
get
in interface WeakHashClock<K,V>
key
- The key to search for, may not be nullpublic V remove(K key)
WeakHashClock
remove
in interface WeakHashClock<K,V>
key
- The key to remove, may not be nullpublic void releaseMatching(CacheKeyFilter<K> filter)
WeakHashClock
releaseMatching
in interface WeakHashClock<K,V>
filter
- A non-null filter that can be used
to delete every key/value pair that matches the filterpublic int size()
WeakHashClock
size
in interface WeakHashClock<K,V>
public Map.Entry<K,V> next()
WeakHashClock
next
in interface WeakHashClock<K,V>
public void clear()
WeakHashClock
clear
in interface WeakHashClock<K,V>
public void clearStaleReferences()
WeakHashClock
clearStaleReferences
in interface WeakHashClock<K,V>
public boolean hasWeakKeys()
WeakHashClock
hasWeakKeys
in interface WeakHashClock<K,V>
Copyright © 2009-2017, Oracle and/or its affiliates. All Rights Reserved.