Records Patterns, Performance and Serialization - JEP Café #8

This #JEPCafe discusses JEP 395: Records, released with JDK 16. We start with a short recap on what records are, then discuss the performances of the hash code computation with the `hashCode()` method, and the comparison of records using the `equals()` method. The performances are compared with the data objects offered by Kotlin and Lombok. We also cover record serialization and discuss patterns to serialize your legacy objects using records serialization (and get the security benefits of records serialization!). ⎯⎯⎯⎯⎯⎯ Chapters ⎯⎯⎯⎯⎯⎯ 0:00 Intro 0:53 Carrying immutable state with records 1:32 Writing a record with components 2:47 Using constructors and accessors 5:34 Examining the bytecode of the `equals()`, `hashCode()`, and `toString()` implementations 7:12 Comparing the performances of `hashCode()` with Kotlin and Lombok 8:02 Comparing the performances of `equals()` with Kotlin and Lombok 10:20 Using Records as data transport objects 11:47 Using `writeReplace()` to serialize records 13:2
Back to Top