Record deconstruction and pattern matching in action #JEPCafe #Java #Java21

preview_player
Показать описание
The JEP Café episode 22 about Data Oriented Programming show you how to deconstruct Records using Pattern Matching in a switch expression, while writing an elegant and efficient solution for the Countdown game.
Рекомендации по теме
Комментарии
Автор

Love the videos but would be great if you showed code sample too!

Lasher
Автор

I don’t like the term “deonconstructor.” First, it sounds too much like “destructor” from C++ and that’s just confusing. Second, you are not deconstructing the underlying object. It continues to exist just fine. You’re just extracting property values and assigning them to local variables. In Python, this would seem to be a type of “tuple unpacking.” Java doesn’t have tuples so that might be an odd name, but how about just “property unpacking?” Or unboxing? Isn’t this just a type of unboxing?

RobRoss