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_r339310767
 
 

 ##########
 File path: src/main/java/org/apache/commons/lang3/ArrayUtils.java
 ##########
 @@ -3254,6 +3254,59 @@ public static int indexOf(final Object[] array, final 
Object objectToFind, int s
         return INDEX_NOT_FOUND;
     }
 
+    /**
+     * <p>Finds the indices of the given object in the array.
+     *
+     * <p>This method returns an empty BitSet for a {@code null} input array.
+     *
+     * @param array  the array to search through for the object, may be {@code 
null}
+     * @param objectToFind  the object to find, may be {@code null}
+     * @return a BitSet of all the indices of the object within the array,
+     *  an empty BitSet if not found or {@code null} array input
+     * @since 3.10
+     */
+    public static BitSet indexesOf(final Object[] array, final Object 
objectToFind) {
+        return indexesOf(array, objectToFind, 0);
+    }
+
+    /**
+     * <p>Finds the indices of the given object in the array starting at the 
given index.
+     *
+     * <p>This method returns an empty BitSet for a {@code null} input array.
+     *
+     * <p>A negative startIndex is treated as zero. A startIndex larger than 
the array
+     * length will return an empty BitSet.
+     *
+     * @param array  the array to search through for the object, may be {@code 
null}
+     * @param objectToFind  the object to find, may be {@code null}
+     * @param startIndex  the index to start searching at
+     * @return a BitSet of all the indices of the object within the array 
starting at the index,
+     *  an empty BitSet if not found or {@code null} array input
+     * @since 3.10
+     */
+    public static BitSet indexesOf(final Object[] array, final Object 
objectToFind, int startIndex) {
+        BitSet ret = new BitSet();
 
 Review comment:
   It seems to me "ret" is not a great name, how about "bitSet"?

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to