ali-ghanbari commented on pull request #804:
URL: https://github.com/apache/commons-lang/pull/804#issuecomment-974685973


   I understand @garydgregory 's concern about keeping `ArrayUtils`'s cohesion 
high.
   So, I am suggesting the following. Please kindly let me know what you think.
   I am planning to create a new class named `SortedArrays` which might have 
other methods in it in the future.
   For the time being, I want to add an enum (as a subclass), named 
`BinarySearchStrategy`, with three elements `ANY`, `FIRST`, and `LAST`.
   `BinarySearchStrategy` implements an interface with many variants of the 
methods `binarySearch`, `floor`, and `ceiling`.
   JDK's `Arrays.binarySearch` return's _any_ index matching a search key, but 
with `FIRST` and `LAST` we extend this functionality to return first/last index 
matching a search key (these two strategies make more sense in a sorted array 
with duplicates).
   We can have similar strategies for `floor` and `ceiling`.
   I think this will make addition of these new features more manageable.
   
   I also suggest adding this class to: Commons Lang or Commons Collections for 
we are essentially extending `java.util.Arrays`.
   
   As soon as we decide on the right module for this, I will raise my PR :) 
Thanks


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