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 2018/08/26 10:27:53 UTC

[4/5] groovy git commit: Trivial refactoring: avoid 'List.remove()' called in loop

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/746240ff
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/746240ff
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/746240ff

Branch: refs/heads/GROOVY_2_5_X
Commit: 746240ff1593c88c06e130c5200bee60a9d58cbd
Parents: a862f2c
Author: Daniel Sun <su...@apache.org>
Authored: Sun Aug 26 17:52:17 2018 +0800
Committer: Daniel Sun <su...@apache.org>
Committed: Sun Aug 26 18:05:53 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/746240ff/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