The equals / hashCode contract determines whether hash-based collections work correctly. Two objects that are equal according to equals must produce the same hashCode, and the fields used must not change while the object is in a HashSet or is a HashMap key. A record respects this contract automatically.
Example
record Produit(int id, String nom) {} // equals and hashCode generated