hashCode()

A method that produces an integer used by hash-based collections.

What does hashCode() do in Java?

hashCode() — A method that produces an integer used by hash-based collections.

record Product(String name) {
}

class ProductCheck {
    boolean sameProduct(Product first, Product second) {
        return first.equals(second);
    }
}

Level: Journeyman · More Java terms at this level

Updated