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, values
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
equals, hashCode, toString
finalize, getClass, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
public 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 © 2024. All rights reserved.