public static final class ConcurrentLinkedHashMap.Weighers extends Object
ConcurrentLinkedHashMap.Weigher implementations.| 构造器和说明 |
|---|
Weighers() |
| 限定符和类型 | 方法和说明 |
|---|---|
static <K,V> ConcurrentLinkedHashMap.EntryWeigher<K,V> |
asEntryWeigher(ConcurrentLinkedHashMap.Weigher<? super V> weigher)
A entry weigher backed by the specified weigher.
|
static ConcurrentLinkedHashMap.Weigher<byte[]> |
byteArray()
A weigher where the value is a byte array and its weight is the number of
bytes.
|
static <E> ConcurrentLinkedHashMap.Weigher<? super Collection<E>> |
collection()
A weigher where the value is a
Collection and its weight is the
number of elements. |
static <K,V> ConcurrentLinkedHashMap.EntryWeigher<K,V> |
entrySingleton()
A weigher where an entry has a weight of 1.
|
static <E> ConcurrentLinkedHashMap.Weigher<? super Iterable<E>> |
iterable()
A weigher where the value is a
Iterable and its weight is the
number of elements. |
static <E> ConcurrentLinkedHashMap.Weigher<? super List<E>> |
list()
A weigher where the value is a
List and its weight is the number
of elements. |
static <A,B> ConcurrentLinkedHashMap.Weigher<? super Map<A,B>> |
map()
A weigher where the value is a
Map and its weight is the number of
entries. |
static <E> ConcurrentLinkedHashMap.Weigher<? super Set<E>> |
set()
A weigher where the value is a
Set and its weight is the number
of elements. |
static <V> ConcurrentLinkedHashMap.Weigher<V> |
singleton()
A weigher where a value has a weight of 1.
|
public static <K,V> ConcurrentLinkedHashMap.EntryWeigher<K,V> asEntryWeigher(ConcurrentLinkedHashMap.Weigher<? super V> weigher)
K - keyV - valueweigher - the weigher to be "wrapped" in a entry weigher.public static <K,V> ConcurrentLinkedHashMap.EntryWeigher<K,V> entrySingleton()
K - keyV - valuepublic static <V> ConcurrentLinkedHashMap.Weigher<V> singleton()
V - valuepublic static ConcurrentLinkedHashMap.Weigher<byte[]> byteArray()
A value with a weight of 0 will be rejected by the map. If a value with this weight can occur then the caller should eagerly evaluate the value and treat it as a removal operation. Alternatively, a custom weigher may be specified on the map to assign an empty value a positive weight.
public static <E> ConcurrentLinkedHashMap.Weigher<? super Iterable<E>> iterable()
Iterable and its weight is the
number of elements. This weigher only should be used when the alternative
collection() weigher cannot be, as evaluation takes O(n) time. A
map bounded with this weigher will evict when the total number of elements
exceeds the capacity rather than the number of key-value pairs in the map.
A value with a weight of 0 will be rejected by the map. If a value with this weight can occur then the caller should eagerly evaluate the value and treat it as a removal operation. Alternatively, a custom weigher may be specified on the map to assign an empty value a positive weight.
E - elementpublic static <E> ConcurrentLinkedHashMap.Weigher<? super Collection<E>> collection()
Collection and its weight is the
number of elements. A map bounded with this weigher will evict when the
total number of elements exceeds the capacity rather than the number of
key-value pairs in the map.
A value with a weight of 0 will be rejected by the map. If a value with this weight can occur then the caller should eagerly evaluate the value and treat it as a removal operation. Alternatively, a custom weigher may be specified on the map to assign an empty value a positive weight.
E - elementpublic static <E> ConcurrentLinkedHashMap.Weigher<? super List<E>> list()
List and its weight is the number
of elements. A map bounded with this weigher will evict when the total
number of elements exceeds the capacity rather than the number of
key-value pairs in the map.
A value with a weight of 0 will be rejected by the map. If a value with this weight can occur then the caller should eagerly evaluate the value and treat it as a removal operation. Alternatively, a custom weigher may be specified on the map to assign an empty value a positive weight.
E - elementpublic static <E> ConcurrentLinkedHashMap.Weigher<? super Set<E>> set()
Set and its weight is the number
of elements. A map bounded with this weigher will evict when the total
number of elements exceeds the capacity rather than the number of
key-value pairs in the map.
A value with a weight of 0 will be rejected by the map. If a value with this weight can occur then the caller should eagerly evaluate the value and treat it as a removal operation. Alternatively, a custom weigher may be specified on the map to assign an empty value a positive weight.
E - elementpublic static <A,B> ConcurrentLinkedHashMap.Weigher<? super Map<A,B>> map()
Map and its weight is the number of
entries. A map bounded with this weigher will evict when the total number of
entries across all values exceeds the capacity rather than the number of
key-value pairs in the map.
A value with a weight of 0 will be rejected by the map. If a value with this weight can occur then the caller should eagerly evaluate the value and treat it as a removal operation. Alternatively, a custom weigher may be specified on the map to assign an empty value a positive weight.
A - KEYB - VALUECopyright © 2021. All rights reserved.