Map项目中的实例
来源:互联网 发布:只有方阵才有逆矩阵吗 编辑:程序博客网 时间:2024/06/01 18:14
package com.power7000.service.impl.sun.sts;import java.util.concurrent.ConcurrentHashMap;import org.apache.log4j.Logger;public class PowerDataMonthlyMap { private static Logger logger = Logger.getLogger(PowerDataMonthlyMap.class); private PowerDataMonthlyMap(){} private static PowerDataMonthlyMap powerDataMonthlyMap; public static PowerDataMonthlyMap getInstance() { if(powerDataMonthlyMap == null) { powerDataMonthlyMap = new PowerDataMonthlyMap(); } return powerDataMonthlyMap; }private final ConcurrentHashMap<String, TimeTagCombinedActive> powerDataMonthlymap = new ConcurrentHashMap<String, TimeTagCombinedActive>(); public TimeTagCombinedActive get(String key) { if (this.checkExist(key)) { return powerDataMonthlymap.get(key); } return null; }public void remove(String key) { try { powerDataMonthlymap.remove(key); } catch (NullPointerException e) { logger.error(e); } } public void add(String key, TimeTagCombinedActive timeTagCombinedActive) { if (key == null || timeTagCombinedActive == null) { return; } try { powerDataMonthlymap.put(key, timeTagCombinedActive); } catch (NullPointerException e) { logger.error(e); } }public boolean checkExist(String key) { try { return powerDataMonthlymap.containsKey(key); } catch (NullPointerException e) { // 写入日志 logger.error(e); return false; } } /** * session * @return */ public ConcurrentHashMap<String, TimeTagCombinedActive> getSessionMap(){ return powerDataMonthlymap; }}
0 0
- Map项目中的实例
- Hibernate HQL 中的select new map 使用实例 嵌套Map
- 实际项目中的一个实例
- UMEditor项目中的引用实例
- Map实例
- 实例讲解hadoop中的map/reduce查询(python语言实现)
- 实例讲解hadoop中的map/reduce查询(python语言实现)
- 项目中的一些Javascript应用实例
- symfony2项目中的单测实例
- spring quartz在项目中的应用实例
- 操作项目中的资源文件-*.properties实例
- Java开发项目实例中的技术总结
- activeMQ实例在项目中的运用【项目实战系列】
- activeMQ实例在项目中的运用二【项目实战系列】
- activeMQ实例在项目中的运用【项目实战系列】
- activeMQ实例在项目中的运用二【项目实战系列】
- activeMQ实例在项目中的运用【项目实战系列】
- activeMQ实例在项目中的运用二【项目实战系列】
- 【BZOJ4310】跳蚤,后缀数组+ST表求LCP+二分答案
- java序列化问题
- Mac命令行高亮
- 关于python中的字符类型及逻辑运算符
- Dockerfile 属性介绍
- Map项目中的实例
- iOS开发,UIWebview与H5之间的交互
- 通过telnet连接查看memcache服务器
- 关于网络请求
- Java高级之内存模型分析
- 36. Valid Sudoku
- git的windows客户端sourcetree使用
- c++ 输入注意
- java List(分割)分批处理