📄 cacheimpl.java
字号:
package com.lanx.app.mail;
import java.util.HashMap;
import java.util.Map;
/**
* <p>此cache实现类是一个单例类</p>
*
* @author Ramboo Lan
* @version 1.0
* @Date: 2008-12-10
* */
public class CacheImpl implements Cache{
private static CacheImpl cache = null;
private Map<Object, Object> hashMap = new HashMap<Object, Object>();
private CacheImpl() {
}
public static CacheImpl newInstance() {
if(cache == null)
cache = new CacheImpl();
return cache;
}
public Object get(int index) {
return hashMap.get(index);
}
public Object get(Object key) {
return hashMap.get(key);
}
public void add(Object key,Object value){
hashMap.put(key, value);
}
public void addAll(Map<Object, Object> map){
hashMap.putAll(map);
}
public boolean containsKey(Object key){
return hashMap.containsKey(key);
}
public Object remove(Object key){
return hashMap.remove(key);
}
public int size(){
return hashMap.size();
}
public boolean isEmpty(){
return hashMap.isEmpty();
}
public void destroy(){
hashMap.clear();
hashMap = null;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -