Skip to content

Conversation

@SivaPA08
Copy link

image

Because toKey and toValue return unknown subtypes of K and V, the lambda is inferred as producing Map.Entry<? extends K, ? extends V>, not the exact Map.Entry<K, V> that the collector requires.

Copy link
Collaborator

@fluentfuture fluentfuture left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Casting the full Function type is a bit verbose.

Can you share which javac version you used that produced this error? That can help me reproduce the error.

At the same time, I've changed the lambda to (E e) -> .... I wonder if this change can fix the compilation.

@SivaPA08
Copy link
Author

Yes it fixed the issue.

I use javac 24.

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.

2 participants