Skip to content

Sorting in ArrayMap may be failing to achieve its purpose #18

@gvlasov

Description

@gvlasov

If I understand it correctly, ArrayMap innards are sorted in order to have deterministic ordering of its elements.

If that's true, then there is an error. ArrayMap#Cmp comparator compares string representation of objects if they are not Comparable. String representation is not a deterministic function, because if Object#toString() is not overridden, then it is a function of Object#hashCode(), which is not deterministic by definition. Thus, ordering of ArrayMap is not deterministic if its contents are not Comparable and don't override Object#toString() in a deterministic manner.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions