Skip to content
This repository has been archived by the owner on Aug 20, 2021. It is now read-only.

1.13.2

Compare
Choose a tag to compare
@venusdrogon venusdrogon released this 30 Apr 04:32
· 57 commits to master since this release

feilong-core 1.13.2 发布了,feilong-core 是一个让 Java 开发更简便的工具包。

  1. 让你从大量重复的底层代码中脱身,提高工作效率;
  2. 让你的代码更简炼,易写、易读、易于维护;

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

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

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

[Feature] 🆕

  • #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
 }
  • #776 新增 NotNullOrEmptyStringPredicate
  • #775 新建 RegexStringPredicate
  • #773 新建 StringToDateTransformer

[Update]

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

[版本升级]

  • none

[Remove]

  • none

[Fix Bug] 🐛

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

[Javadoc]

  • none

[Junit Test]

  • none