Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add binary search submodule #382

Open
dmlloyd opened this issue Dec 2, 2024 · 0 comments
Open

Add binary search submodule #382

dmlloyd opened this issue Dec 2, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@dmlloyd
Copy link
Collaborator

dmlloyd commented Dec 2, 2024

I've recreated variations on binary search at least 20 times in the past year. The JDK has two binary search methods, one which searches an array and one which searches a List. These methods only allow searching for the same kind of thing already found in the list. So you can't, for example, search for an item by one of its properties, among other limitations.

A better alternative has been proposed here: https://bugs.openjdk.org/browse/JDK-8326330

However it will be a long time, if ever, before this is introduced into the JDK, and longer before we can use it. On the other hand, this would be very simple to recreate.

Let's consider introducing a module which implements binary search variations. The above method could be used as a starting point, with variations to search by key and other convenience implementations.

@dmlloyd dmlloyd added the enhancement New feature or request label Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant