Skip to content

Conversation

@pivovarit
Copy link
Member

@pivovarit pivovarit commented Aug 28, 2024

To maintain the contract between equals() and hashCode(), the LinkedHashMap#hashCode implementation should account for the order of key-value pairs (tuples).

This ensures that the hashCode reflects the sequence in which entries are added, aligning with the behavior of equals.


Related to: #2803
Fixes: #2733

@pivovarit pivovarit changed the title ordered LinkedHashMap#hashCode() implementation Ordered LinkedHashMap#hashCode() implementation Aug 28, 2024
@pivovarit pivovarit force-pushed the ordered-hashcode-linkedhashmap branch from 1d0c45c to 62f5c00 Compare August 28, 2024 18:15
@pivovarit pivovarit closed this Aug 28, 2024
@pivovarit pivovarit deleted the ordered-hashcode-linkedhashmap branch October 12, 2024 09:45
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.

poor implementation of hashCode of LinkedHashMap

2 participants