hash code

An int that an object computes from its contents so hash-based collections such as HashMap can find it quickly.

In more detail

Objects that are equal must return the same hash code, otherwise they get lost in hash-based sets and maps. Records generate a hashCode consistent with their equals, which makes them safe map keys when their components are.

Related terms

Taught in

References

Certification courses