Pattern Matching in Java - Past, Present, Future

preview_player
Показать описание
_`switch` and `instanceof` have been the gates of data introspection in Java since 1.0. In modern times, the same constructs have been rehabilitated to enable full-blown pattern matching and offer a vision of data-oriented programming to Java developers. In this talk we are going to have a look into what `switch` and `instanceof` are for Java developers today and offer a holistic view of all the exciting directions that can be a possible future for Java's pattern matching abilities._

*Tags:* #Java #OpenJDK
Рекомендации по теме
Комментарии
Автор

The first half hour covers a lot of material we already knew. A few points of interest that are perhaps less well-known:
12:08 - If the condition is negated, the scope of the pattern variable is the "else" block.
25:38 - Synthesized default case that throws MatchException.

The future arrives starting at 32:45
38:35 - Primitive pattern matching safeguards based on value ranges
42:06 - Potential future features
46:15 - Deconstruction of classes
49:20 - Reconstruction of records
50:15 - Reconstruction of classes
51:25 - New serialization

prdoyle
Автор

Hopefully we will get a for(var k, v : map) someday.

ZeroUm_
Автор

great talk sr, it really greafull see how java has been improving in a solid manner, thanks again, you did a great job

haroldpepete
Автор

will they ever change that nightmarish background image?

claudemartin
Автор

Verbosity is something Java is already mocked for, so adding the concept of deconstructor is odd to me. Wasn't it possible to have a syntax like :
case MyClass {fieldName, fieldNameThatIsAnArray[index], fieldNameThatIsARecord(type, type) } -> ....

greatso