mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
按照超哥教的 使用number替换decimal
This commit is contained in:
@@ -306,13 +306,13 @@ public class EasyStream<T> extends AbstractEnhancedWrappedStream<T, EasyStream<T
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算decimal的总和
|
||||
* 计算number的总和
|
||||
*
|
||||
* @param mapper 映射
|
||||
* @return {@link BigDecimal}
|
||||
*/
|
||||
public BigDecimal sum(final Function<? super T, BigDecimal> mapper) {
|
||||
return stream.map(mapper).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
public <R extends Number> BigDecimal sum(final Function<? super T, R> mapper) {
|
||||
return stream.map(mapper).reduce(BigDecimal.ZERO, NumberUtil::add,NumberUtil::add);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user