You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2020/12/28 13:42:23 UTC

[groovy] branch master updated: Trivial refactoring: remove redundant variable

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 ba29de5  Trivial refactoring: remove redundant variable
ba29de5 is described below

commit ba29de52312f5f84417be80ef439176ce82cce32
Author: Daniel Sun <su...@apache.org>
AuthorDate: Mon Dec 28 21:42:02 2020 +0800

    Trivial refactoring: remove redundant variable
---
 .../apache/groovy/ginq/provider/collection/runtime/WindowImpl.java   | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/subprojects/groovy-ginq/src/main/groovy/org/apache/groovy/ginq/provider/collection/runtime/WindowImpl.java b/subprojects/groovy-ginq/src/main/groovy/org/apache/groovy/ginq/provider/collection/runtime/WindowImpl.java
index f89054c..a9cd806 100644
--- a/subprojects/groovy-ginq/src/main/groovy/org/apache/groovy/ginq/provider/collection/runtime/WindowImpl.java
+++ b/subprojects/groovy-ginq/src/main/groovy/org/apache/groovy/ginq/provider/collection/runtime/WindowImpl.java
@@ -47,7 +47,6 @@ class WindowImpl<T, U extends Comparable<? super U>> extends QueryableCollection
         this.currentRecord = currentRecord;
         this.windowDefinition = windowDefinition;
 
-        List<Tuple2<T, Long>> sortedList = listWithIndex;
         final List<Order<? super T, ? extends U>> order = windowDefinition.orderBy();
         if (null != order && 1 == order.size()) {
             this.keyExtractor = order.get(0).getKeyExtractor();
@@ -59,8 +58,8 @@ class WindowImpl<T, U extends Comparable<? super U>> extends QueryableCollection
 
         List<Queryable.Order<? super T, ? extends U>> orderList = windowDefinition.orderBy();
         int tmpIndex = null == orderList || orderList.isEmpty()
-                        ? binarySearch(sortedList, currentRecord, comparing(Tuple2::getV2))
-                        : binarySearch(sortedList, currentRecord, makeComparator(composeOrders(orderList)).thenComparing(Tuple2::getV2));
+                        ? binarySearch(listWithIndex, currentRecord, comparing(Tuple2::getV2))
+                        : binarySearch(listWithIndex, currentRecord, makeComparator(composeOrders(orderList)).thenComparing(Tuple2::getV2));
 
         this.index = tmpIndex >= 0 ? tmpIndex : -tmpIndex - 1;
     }