This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/master by this push:
     new 9ff3ecf  Trivial refactoring: simplify code
9ff3ecf is described below

commit 9ff3ecf91a179c0f26ee553f74e3925b2c9ef1c0
Author: Daniel Sun <[email protected]>
AuthorDate: Sat Dec 12 15:30:21 2020 +0800

    Trivial refactoring: simplify code
---
 .../groovy/ginq/provider/collection/runtime/QueryableCollection.java  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/subprojects/groovy-ginq/src/main/groovy/org/apache/groovy/ginq/provider/collection/runtime/QueryableCollection.java
 
b/subprojects/groovy-ginq/src/main/groovy/org/apache/groovy/ginq/provider/collection/runtime/QueryableCollection.java
index 2453666..191ff2c 100644
--- 
a/subprojects/groovy-ginq/src/main/groovy/org/apache/groovy/ginq/provider/collection/runtime/QueryableCollection.java
+++ 
b/subprojects/groovy-ginq/src/main/groovy/org/apache/groovy/ginq/provider/collection/runtime/QueryableCollection.java
@@ -314,9 +314,9 @@ class QueryableCollection<T> implements Queryable<T>, 
Serializable {
     @Override
     public BigDecimal avg(Function<? super T, ? extends Number> mapper) {
         Object[] result = agg(q -> this.stream()
-                .map(mapper::apply)
+                .map(mapper)
                 .filter(Objects::nonNull)
-                .map(n -> NumberMath.toBigDecimal(n))
+                .map(NumberMath::toBigDecimal)
                 .reduce(new Object[] {0L, BigDecimal.ZERO}, (r, e) -> {
                     r[0] = (Long) r[0] + 1;
                     r[1] = ((BigDecimal) r[1]).add(e);

Reply via email to