码迷,mamicode.com
首页 > 其他好文 > 详细

如何从map中提取value并转换成long

时间:2018-04-08 13:23:29      阅读:382      评论:0      收藏:0      [点我收藏+]

标签:summary   first   cell   convert   acl   epo   .com   extern   div   

 

old:

taskReportDataDTO.setUv(Long.valueOf(hbaseData.get(HbaseColumnEnum.uv).toString()));

 

 new:

taskReportDataDTO.setPv(MapUtils.getLong(hbaseData, HbaseColumnEnum.pv.name().toLowerCase(), 0L));

 

 

http://commons.apache.org/proper/commons-collections/apidocs/org/apache/commons/collections4/MapUtils.html

static <K> Long getLong(Map<? super K,?> map, K key, Long defaultValue)
Looks up the given key in the given map, converting the result into a long, using the default value if the the conversion fails.

如何从map中提取value并转换成long

标签:summary   first   cell   convert   acl   epo   .com   extern   div   

原文地址:https://www.cnblogs.com/iwangzheng/p/8744080.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!