内容简介:feilong-core 1.13.2,让 Java 开发更简便的工具包 本次升级共有 8 处变更, 具体参见 1.13.2 milestone 1.13.2 文档地址: http://feilong-core.mydoc.io/ 单元测试数 增加至 2124 个, 单元测试覆盖率 增加至 91% ...
feilong-core 1.13.2,让 Java 开发更简便的 工具 包
本次升级共有 8 处变更, 具体参见 1.13.2 milestone
1.13.2 文档地址: http://feilong-core.mydoc.io/
单元测试数 增加至 2124 个, 单元测试覆盖率 增加至 91% ,javadoc 比率 83%
[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
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Probability and Computing
Michael Mitzenmacher、Eli Upfal / Cambridge University Press / 2005-01-31 / USD 66.00
Assuming only an elementary background in discrete mathematics, this textbook is an excellent introduction to the probabilistic techniques and paradigms used in the development of probabilistic algori......一起来看看 《Probability and Computing》 这本书的介绍吧!