sebbASF commented on code in PR #1270:
URL: https://github.com/apache/commons-lang/pull/1270#discussion_r1758299410


##########
src/main/java/org/apache/commons/lang3/ArrayUtils.java:
##########
@@ -1432,6 +1432,115 @@ public static <T> T arraycopy(final T source, final int 
sourcePos, final T dest,
         return dest;
     }
 
+    /**
+     * Searches element in array sorted by key.
+     *
+     * @param array
+     *      array sorted by key field
+     * @param key
+     *      key to search for
+     * @param keyExtractor
+     *      function to extract key from element
+     * @param comparator
+     *      comparator for keys
+     *
+     * @return
+     *      index of the search key, if it is contained in the array within 
specified range; otherwise,
+     *      (-first_greater - 1).  The first_greater is the index of lowest 
greater element in the list - if all elements
+     *      are lower, the first_greater is defined as toIndex.

Review Comment:
   If there are multiple matches, would it not be better to return both 
indexes, so all the entries can be accessed?
   Rather than return a single index, why not return first and last?
   If they are the same, there is a unique match.
   I'm not sure what the use case is for choosing either First or Last rather 
than both.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to