feilong-core 1.13.2 釋出啦,讓 Java 開發更簡便的工具包
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