Skip to content
New issue

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

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

Already on GitHub? # to your account

Don't let ParseCallback extend BiFunction #89

Open
Marcono1234 opened this issue Mar 24, 2025 · 0 comments
Open

Don't let ParseCallback extend BiFunction #89

Marcono1234 opened this issue Mar 24, 2025 · 0 comments

Comments

@Marcono1234
Copy link
Contributor

Problem

Currently ParseCallback extends java.util.function.BiFunction. That requires it to use the boxed type Integer as parameter instead of the primitive type int. This might cause some performance overhead due to boxing and unboxing (I haven't measured it though).

Suggested solution

Don't let ParseCallback extend java.util.function.BiFunction. Even without extending BiFunction users can use a lambda expression or method reference for this interface. And you can then freely choose parameter and return types.

I am not sure if extending BiFunction provides much or any advantages. For example the default methods such as BiFunction#andThen return a BiFunction, so they cannot be used for anything which expects a ParseCallback.

What do you think?

(This also applies to Logger which extends BiConsumer.)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant