8000 Immutable.Map hashCode collision when swapping the boolean values in an object · Issue #1894 · immutable-js/immutable-js · GitHub
[go: up one dir, main page]

Skip to content
Immutable.Map hashCode collision when swapping the boolean values in an object #1894
Open
@brianshih1

Description

@brianshih1

What happened

I created two immutable.Map instances as follows:

const first = immutable.Map({ foo: true, valid: false })
const second = immutable.Map({ foo: false, valid: true })

These two objects have the same keys but swapped boolean values.

I noticed that they have the same hashCode. I would've assumed the hashCode is different since all I did is swap the boolean values for the two keys. This also seems to happen for these specific combination of words since the hashCode is different if I swap valid for bar.

How to reproduce

Create the two immutable.Map instances and look at the hashCode

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0