You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2019/10/26 18:35:22 UTC

[GitHub] [commons-lang] garydgregory commented on a change in pull request #471: [LANG-1177] Added indexesOf methods and simplified removeAllOccurences

garydgregory commented on a change in pull request #471: [LANG-1177] Added indexesOf methods and simplified removeAllOccurences
URL: https://github.com/apache/commons-lang/pull/471#discussion_r339310329
 
 

 ##########
 File path: src/main/java/org/apache/commons/lang3/ArrayUtils.java
 ##########
 @@ -8202,20 +8654,8 @@ public static boolean isSorted(final boolean[] array) {
      * @since 3.5
      */
     public static float[] removeAllOccurences(final float[] array, final float element) {
-        int index = indexOf(array, element);
-        if (index == INDEX_NOT_FOUND) {
-            return clone(array);
-        }
-
-        final int[] indices = new int[array.length - index];
-        indices[0] = index;
-        int count = 1;
-
-        while ((index = indexOf(array, element, indices[count - 1] + 1)) != INDEX_NOT_FOUND) {
-            indices[count++] = index;
-        }
-
-        return removeAll(array, Arrays.copyOf(indices, count));
+        BitSet foundBits = indexesOf(array, element);
 
 Review comment:
   How about inlining all of the 'foundBits'?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services