Skip to content

Hashcode optimisation #37

@tom-zoladz

Description

@tom-zoladz

GF found in J.Bloch books that current hashCode method is not recommended due to low efficiency. Current solution for Entry class:

@Override
public int hashCode() {
    return Objects.hash(key, value, type, info);
}

Consider to use:

    @Override
    public int hashCode() {
        return key != null ? key.hashCode() : 0;
    }

because key parameter looks like to be unique.

Consider to update hashcode for other classes in similar way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions