Skip to content

Glossary: Data Structures and Algorithms in Java

record

Also written: records

A short class form that holds named components and gets `equals`, `hashCode` and `toString` for free. Because it cannot change, a record is a safe HashMap key, such as `CityProduct` or `Road`.

Where the book teaches it

Related terms

hashableimmutableequalshashCode