日期:2014-05-17 浏览次数:20733 次
package test; import java.util.HashMap; import java.util.Map; public class SingleTon { private Map<Object,Object> map; private static SingleTon singleTon; private SingleTon(){ map = new HashMap<Object,Object>(); } public static SingleTon getSingleTon(){ if(singleTon == null){ singleTon = new SingleTon(); } return singleTon; } public void put(Object key, Object value){ map.put(key, value); } public Object get(Object key){ return map.get(key); } }