由买买提看人间百态

topics

全部话题 - 话题: testing2
(共0页)
w*********t
发帖数: 170
1
来自主题: JobHunting版 - LRU question
class LRU{
private final static int MAX_SIZE= 3;
private Map map;
public LRU(){
map = new LinkedHashMap(MAX_SIZE,0.75F,true){
public boolean removeEldestEntry(Map.Entry eldest){
return map.size() > MAX_SIZE;
}
};
}
public void add(K k,V v){
map.put(k,v);
}

public V get(K k){
return map.get(k);
}

public void printLRU(){
for(V v:map.values()){
... 阅读全帖
s*********2
发帖数: 216
2
来自主题: _LaureShang版 - 为啥名字这么淡啊?
testing2
(共0页)