Package com.formdev.flatlaf.util
Class SoftCache<K,V>
- java.lang.Object
-
- com.formdev.flatlaf.util.SoftCache<K,V>
-
- All Implemented Interfaces:
java.util.Map<K,V>
public class SoftCache<K,V> extends java.lang.Object implements java.util.Map<K,V>
A simple cache (map) that uses soft references for the values.- Since:
- 2
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
SoftCache.CacheReference<K,V>
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
boolean
containsKey(java.lang.Object key)
boolean
containsValue(java.lang.Object value)
Not supported.java.util.Set<java.util.Map.Entry<K,V>>
entrySet()
Not supported.private void
expungeStaleEntries()
void
forEach(java.util.function.BiConsumer<? super K,? super V> action)
Not supported.V
get(java.lang.Object key)
private V
getRef(SoftCache.CacheReference<K,V> ref)
boolean
isEmpty()
java.util.Set<K>
keySet()
V
put(K key, V value)
void
putAll(java.util.Map<? extends K,? extends V> m)
V
remove(java.lang.Object key)
void
replaceAll(java.util.function.BiFunction<? super K,? super V,? extends V> function)
Not supported.int
size()
java.util.Collection<V>
values()
Not supported.
-
-
-
Field Detail
-
map
private final java.util.Map<K,SoftCache.CacheReference<K,V>> map
-
queue
private final java.lang.ref.ReferenceQueue<V> queue
-
-
Method Detail
-
containsKey
public boolean containsKey(java.lang.Object key)
-
containsValue
public boolean containsValue(java.lang.Object value)
Not supported. ThrowsUnsupportedOperationException
.
-
getRef
private V getRef(SoftCache.CacheReference<K,V> ref)
-
values
public java.util.Collection<V> values()
Not supported. ThrowsUnsupportedOperationException
.
-
entrySet
public java.util.Set<java.util.Map.Entry<K,V>> entrySet()
Not supported. ThrowsUnsupportedOperationException
.
-
forEach
public void forEach(java.util.function.BiConsumer<? super K,? super V> action)
Not supported. ThrowsUnsupportedOperationException
.
-
replaceAll
public void replaceAll(java.util.function.BiFunction<? super K,? super V,? extends V> function)
Not supported. ThrowsUnsupportedOperationException
.
-
expungeStaleEntries
private void expungeStaleEntries()
-
-