groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject [4/4] groovy git commit: Trivial refactoring: avoid 'List.remove()' called in loop
Date Sun, 26 Aug 2018 10:27:32 GMT
Trivial refactoring: avoid 'List.remove()' called in loop


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/688b3dc3
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/688b3dc3
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/688b3dc3

Branch: refs/heads/master
Commit: 688b3dc3b833c71b2270ab958d5ce84405fd4a41
Parents: 928615f
Author: Daniel Sun <sunlan@apache.org>
Authored: Sun Aug 26 17:52:17 2018 +0800
Committer: Daniel Sun <sunlan@apache.org>
Committed: Sun Aug 26 17:52:17 2018 +0800

----------------------------------------------------------------------
 .../src/main/groovy/groovy/swing/impl/ListWrapperListModel.java  | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/688b3dc3/subprojects/groovy-swing/src/main/groovy/groovy/swing/impl/ListWrapperListModel.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-swing/src/main/groovy/groovy/swing/impl/ListWrapperListModel.java
b/subprojects/groovy-swing/src/main/groovy/groovy/swing/impl/ListWrapperListModel.java
index eb19919..ea29e54 100644
--- a/subprojects/groovy-swing/src/main/groovy/groovy/swing/impl/ListWrapperListModel.java
+++ b/subprojects/groovy-swing/src/main/groovy/groovy/swing/impl/ListWrapperListModel.java
@@ -151,9 +151,7 @@ public class ListWrapperListModel<E> extends AbstractListModel {
         if (fromIndex > toIndex) {
             throw new IllegalArgumentException("fromIndex must be <= toIndex");
         }
-        for (int i = toIndex; i >= fromIndex; i--) {
-            delegate.remove(i);
-        }
+        delegate.subList(fromIndex, toIndex + 1).clear();
         fireIntervalRemoved(this, fromIndex, toIndex);
     }
 }
\ No newline at end of file


Mime
View raw message