Package com.formdev.flatlaf.util
Class SoftCache<K,V>
java.lang.Object
com.formdev.flatlaf.util.SoftCache<K,V>
- All Implemented Interfaces:
Map<K,
V>
A simple cache (map) that uses soft references for the values.
- Since:
- 2
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map
<K, SoftCache.CacheReference<K, V>> private final ReferenceQueue
<V> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
boolean
containsKey
(Object key) boolean
containsValue
(Object value) Not supported.entrySet()
Not supported.private void
void
forEach
(BiConsumer<? super K, ? super V> action) Not supported.private V
getRef
(SoftCache.CacheReference<K, V> ref) boolean
isEmpty()
keySet()
void
void
replaceAll
(BiFunction<? super K, ? super V, ? extends V> function) Not supported.int
size()
values()
Not supported.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace
-
Field Details
-
map
-
queue
-
-
Constructor Details
-
SoftCache
public SoftCache() -
SoftCache
public SoftCache(int initialCapacity)
-
-
Method Details
-
size
public int size() -
isEmpty
public boolean isEmpty() -
containsKey
- Specified by:
containsKey
in interfaceMap<K,
V>
-
containsValue
Not supported. ThrowsUnsupportedOperationException
.- Specified by:
containsValue
in interfaceMap<K,
V>
-
get
-
put
-
remove
-
getRef
-
putAll
-
clear
public void clear() -
keySet
-
values
Not supported. ThrowsUnsupportedOperationException
. -
entrySet
Not supported. ThrowsUnsupportedOperationException
. -
forEach
Not supported. ThrowsUnsupportedOperationException
. -
replaceAll
Not supported. ThrowsUnsupportedOperationException
.- Specified by:
replaceAll
in interfaceMap<K,
V>
-
expungeStaleEntries
private void expungeStaleEntries()
-