Grokking Java Interview Questions
Vote

0% completed

​

Record Patterns

Building a record and taking it apart can be written in the same shape. The expression new Item(product, 3) puts two values into a record, and the pattern Item(Product product, int quantity) takes the two values out again.

This symmetry is possible because the header of a record states its complete data. The four answers below describe the single pattern, the pattern inside a pattern, the style of programming that grew around them, and the programs for which overridden methods remain the better design.

What is a record pattern?

Level: Mid-level

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content