Skip to content

Commit

Permalink
GROOVY-5739: performance problem in DefaultGroovyMethods.removeAll/re…
Browse files Browse the repository at this point in the history
…tainAll (thanks to Adrian Nistor)
  • Loading branch information
paulk-asert committed Oct 4, 2012
1 parent 5fc03a7 commit c5c516e
Showing 1 changed file with 6 additions and 2 deletions.
Expand Up @@ -3211,7 +3211,9 @@ public static boolean containsAll(Collection self, Object[] items) {
* @since 1.7.2
*/
public static boolean removeAll(Collection self, Object[] items) {
return self.removeAll(Arrays.asList(items));
Collection pickFrom = new TreeSet(new NumberAwareComparator());
pickFrom.addAll(Arrays.asList(items));
return self.removeAll(pickFrom);
}

/**
Expand All @@ -3229,7 +3231,9 @@ public static boolean removeAll(Collection self, Object[] items) {
* @since 1.7.2
*/
public static boolean retainAll(Collection self, Object[] items) {
return self.retainAll(Arrays.asList(items));
Collection pickFrom = new TreeSet(new NumberAwareComparator());
pickFrom.addAll(Arrays.asList(items));
return self.retainAll(pickFrom);
}

/**
Expand Down

0 comments on commit c5c516e

Please sign in to comment.