K - 键类型V - 值类型public class FixedLinkedHashMap<K,V> extends LinkedHashMap<K,V>
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Constructor and Description |
|---|
FixedLinkedHashMap(int capacity)
构造
|
| Modifier and Type | Method and Description |
|---|---|
int |
getCapacity()
获取容量
|
protected boolean |
removeEldestEntry(Map.Entry<K,V> eldest) |
void |
setCapacity(int capacity)
设置容量
|
void |
setRemoveListener(Consumer<Map.Entry<K,V>> removeListener)
设置自定义移除监听
|
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, replaceAll, valuesclone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, sizeequals, hashCode, toStringfinalize, getClass, notify, notifyAll, wait, wait, waitcompute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, sizepublic FixedLinkedHashMap(int capacity)
capacity - 容量,实际初始容量比容量大1public int getCapacity()
public void setCapacity(int capacity)
capacity - 容量public void setRemoveListener(Consumer<Map.Entry<K,V>> removeListener)
removeListener - 移除监听protected boolean removeEldestEntry(Map.Entry<K,V> eldest)
removeEldestEntry in class LinkedHashMap<K,V>Copyright © 2025. All rights reserved.