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 collectors for Maps #256

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

shawjef3
Copy link

@shawjef3 shawjef3 commented Jun 24, 2021

This adds collectors for Stream to fastutil Maps.

Future improvements would be to investigate supporting primitive streams (e.g. IntStream) and improving the type signature for collectors where char is the key or value. When char is the key, the functions are for int. When char is the value, the functions are for Object.

Also there is boxing that could be avoided using more specialized function types, like Int2IntFunction instead of ToIntFunction<Integer>.

@vigna
Copy link
Owner

vigna commented Jun 28, 2021

I won't be able to look at this for a couple of weeks as I'll be travelling. Did you use some of the infrastructure for primitive functions (look for PRIMITIVE_FUNCTION in gencsources.sh)?

@shawjef3
Copy link
Author

shawjef3 commented Jul 6, 2021

I tried to use JDK_PRIMITIVE_FUNCTION, but ran into many places it didn't fit. For instance, in Byte2BooleanMaps, the collector needs Object2ByteFunction<T> for the keys, and Predicate<T> for the values. However, JDK_PRIMITIVE_FUNCTION gives IntPredicate, which isn't applicable to the collector.

@shawjef3
Copy link
Author

@vigna just a reminder to get eyes on this.

@vigna
Copy link
Owner

vigna commented Aug 30, 2021

Ahem, I know I'm late, but I'm on vacation now. I'll be back to work in full in a couple of weeks.

@vigna
Copy link
Owner

vigna commented Feb 4, 2022

So, the way we did that for other containers is quite different—see, e.g., toSet() in OpenHashSet.drv. It would be better to try to follow the same scheme.

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

Successfully merging this pull request may close these issues.

None yet

2 participants