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

Question related to removed overloaded 'map' methods in AbstractMapping #93

Closed
kowalczm opened this issue Jun 9, 2020 · 4 comments
Closed

Comments

@kowalczm
Copy link

kowalczm commented Jun 9, 2020

Hi,
In f051e55
I saw that few oveloaded functions were removed in AbstractMapping (mapBoolean, mapLong). Is it intentional?

@bytefish
Copy link
Member

bytefish commented Jun 9, 2020

Semi-Intentional. I thought they are not used anymore and I was throwing some code out. I was a little over the top. 😓

I'll re-add them and release an update to Maven. Give me a moment.

@kowalczm
Copy link
Author

kowalczm commented Jun 9, 2020

Ok, I'm involved to projects related with this library now but having classes with primitve types is quite common and converting them to object types (boxing) is very expensive especially in cases when you process millions of millions of such objects

@bytefish
Copy link
Member

Now looking at the code, I remember why I did this... If you overload the methods in such a way, Java with its glorious Type Erasure cannot make sense, which method applies:

image

This is a problem, because I want people to be able to write stuff like the above.

I will change the API Surface to mapBoolean / mapBooleanPrimitive, so you can explictly choose which way to go and not have to overload the Functional Interfaces.

I will also add a part to the README.

bytefish added a commit that referenced this issue Jun 11, 2020
bytefish added a commit that referenced this issue Jun 11, 2020
bytefish added a commit that referenced this issue Jun 11, 2020
@bytefish
Copy link
Member

I've added the functions again, but one has to decide explicitly wether to use the Primitive type or not. This is not perfect, but at least it doesn't lead to the kind of error above.

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

No branches or pull requests

2 participants