Java record
A Java record is a restricted class declaration for representing data with a fixed set of components and compiler-derived members such as constructors, accessors, and object methods.
The Art of Code
A Java record is a concise Java class declaration for immutable data-oriented objects with automatically derived members.
- How it is used
- Models small immutable domain data so call sites, return types, and transformations communicate intent clearly.
- How deep it goes
- Explains declaration, generated members, compact constructors, validation, typed composition, and record pattern matching, while deferring full generated-code detail.
- Examples
- Uses Person normalization, Employee refactoring, physical-profile BMI classification, typed result records, and people-analysis statistics.
- What you can do after
- Apply it via Java records to define validated immutable carriers and replace generic or boilerplate-heavy data models.
Spring AI in Action
A Java record is a restricted Java class for declaring compact immutable data-carrier types.
- How it is used
- Uses records as compact request and response models in a Spring AI REST application.
- How deep it goes
- Defines single-property records and demonstrates access and construction, but does not develop advanced record features.
- Examples
- Uses Question(String question) and Answer(String answer) as request and generated-answer carriers.
- What you can do after
- Builds compact Java data carriers for application inputs and outputs.
Troubleshooting Java, Second Edition
A Java record is a Java class-like language feature for declaring data-oriented types with implicitly final components and generated data-access methods.
- How it is used
- Strengthens model-layer immutability while constraining on-the-fly data changes during debugging.
- How deep it goes
- Defines implicit final components and the resulting debugger limitation, but does not detail record syntax or generated methods.
- Examples
- Uses paused-debugger variable changes and an "abcd" input to contrast mutable investigation cases with immutable record components.
- What you can do after
- Diagnose debugging constraints by recognizing when record immutability prevents changing investigation data in the IDE.
Read how Troubleshooting Java, Second Edition explains Java record →
100 Java Mistakes and How to Avoid Them
A Java record is a restricted class declaration for modeling data-carrier objects with a compact syntax for components and associated members.
- How it is used
- Uses Java records to store data while avoiding hand-written equality implementations.
- How deep it goes
- Explains compiler-generated equals() and hashCode(), but does not detail record syntax or component semantics.
- Examples
- Uses malformed hand-written equals() implementations, IDE generation dialogs, and EqualsVerifier as practical comparisons.
- What you can do after
- Evaluate when records can replace manual equals() and hashCode() implementations.
Read how 100 Java Mistakes and How to Avoid Them explains Java record →
Related concepts
- contractimplements · An API contract is a specification of the operations, data, and behavioral expectations that govern interactions between software components.
- product typekind of · A product type is a composite type whose values combine one value from each of several component types, such as a tuple or record.
- value objectproduces · A value object is an object whose meaning and equality derive from its attribute values rather than an independent identity, typically with immutable state.
- attributehas part · An attribute is a named property, value, or piece of information associated with an entity, object, or program element.
- immutable collectionkind of · An immutable collection is a collection whose membership and contents cannot be changed after creation.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.



