当前位置: 软件>java软件
Java高性能集合类 ConcurrentLinkedHashMap
本文导语: ConcurrentLinkedHashMap是java.util.LinkedHashMap的一个高性能实现。主要用于软件缓存。 示例代码: EvictionListener listener = new EvictionListener() { @Override public void onEviction(K key, V value) { System.out.println("Evicted key=" + key + ", value=" + value); ...
ConcurrentLinkedHashMap是java.util.LinkedHashMap的一个高性能实现。主要用于软件缓存。
示例代码:
EvictionListener listener = new EvictionListener() {
@Override public void onEviction(K key, V value) {
System.out.println("Evicted key=" + key + ", value=" + value);
}
};
ConcurrentMap cache = new ConcurrentLinkedHashMap.Builder()
.maximumWeightedCapacity(1000)
.listener(listener)
.build();