feilong-core 1.13.2 发布啦,让 Java 开发更简便的工具包

栏目: Java · 发布时间: 7年前

内容简介:feilong-core 1.13.2,让 Java 开发更简便的工具包本次升级共有1.13.2 文档地址:

feilong-core 1.13.2,让 Java 开发更简便的 工具

本次升级共有 8 处变更, 具体参见   1.13.2 milestone

1.13.2 文档地址: http://feilong-core.mydoc.io/

单元测试数 增加至 2124 个, 单元测试覆盖率 增加至 91% ,javadoc 比率 83%

[Feature] :new:

  • #770 新增 AggregateUtil.groupSum(Iterable<O> beanIterable, String keyPropertyName, String sumPropertyName)

迭代 beanIterable,取元素 keyPropertyName 的值为 key ,累计 sumPropertyName 属性值 为 value,返回 map.

示例:

统计 user list 按照姓名分组, 累加每个人的 age 总和

List<User> list = toList(//
               new User("张飞", 20),
               new User("关羽", 20),
               new User("刘备", 20),
               new User("刘备", 20));

Map<String, BigDecimal> map = AggregateUtil.groupSum(list, "name", "age");

assertThat(
               map,
               allOf(//
                               hasEntry("刘备", toBigDecimal(40)),
                               hasEntry("张飞", toBigDecimal(20)),
                               hasEntry("关羽", toBigDecimal(20))));
  • #771 新增 AggregateUtil.groupSum(Iterable<O>, String, String, Predicate<O>)

  • #769 新增 MapUtil.putSumValue(Map<String, BigDecimal>, String, Number)

将key和value 累加的形式put到 map中,如果map中存在key,那么累加value值;如果不存在那么直接put.

常用于数据统计, 比如 com.feilong.core.util.AggregateUtil.groupSum(Iterable, String, String)

示例:

 Map<String, BigDecimal> map = new HashMap<>();
 MapUtil.putSumValue(map, "1000001", 5);
 MapUtil.putSumValue(map, "1000002", 5);
 MapUtil.putSumValue(map, "1000002", 5);
 LOGGER.debug(JsonUtil.format(map));

返回:

 {
 "1000001": 5,
 "1000002": 10
 }
NotNullOrEmptyStringPredicate
RegexStringPredicate
StringToDateTransformer

[Update]

  • #772 BeanUtil.newDynaBean(Map<String, ?>) map 改成Map<?, ?>

[版本升级]

  • none

[Remove]

  • none

[Fix Bug] :bug:

  • #774 RegexUtil.matches(String, CharSequence) 如果 CharSequence 是 null 返回 false 而不应该是 NPE

[Javadoc]

  • none

[Junit Test]

  • none

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Parsing Techniques

Parsing Techniques

Dick Grune、Ceriel J.H. Jacobs / Springer / 2010-2-12 / USD 109.00

This second edition of Grune and Jacobs' brilliant work presents new developments and discoveries that have been made in the field. Parsing, also referred to as syntax analysis, has been and continues......一起来看看 《Parsing Techniques》 这本书的介绍吧!

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试