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 TypeMethodDescriptionvoidclear()booleancontainsKey(Object key) booleancontainsValue(Object value) Not supported.entrySet()Not supported.private voidvoidforEach(BiConsumer<? super K, ? super V> action) Not supported.private VgetRef(SoftCache.CacheReference<K, V> ref) booleanisEmpty()keySet()voidvoidreplaceAll(BiFunction<? super K, ? super V, ? extends V> function) Not supported.intsize()values()Not supported.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
containsKeyin interfaceMap<K,V>
-
containsValue
Not supported. ThrowsUnsupportedOperationException.- Specified by:
containsValuein 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:
replaceAllin interfaceMap<K,V>
-
expungeStaleEntries
private void expungeStaleEntries()
-