filmov
tv
Data Oriented Programming in Java 21, Solving the Countdown game - JEP Cafe #22
![preview_player](https://i.ytimg.com/vi/Y2pmZlP-cOU/maxresdefault.jpg)
Показать описание
In this JEP Café, we will use a lot of the new features added to the JDK in the context of the Data Oriented Programming support: Records, Sealed Types, Pattern Matching, Unnamed Patterns, Exhaustive Switches, as well as the most recent additions to the Stream API: mapMulti(), and Gatherers (a preview feature of the JDK 22). As a bonus, you will see an anonymous class used as a non-denotable type in action, to create a small wrapper on a mutable content. All this is used to solve a funny problem: the Countdown game, where you need to reach a target with a set of randomly drawn numbers, and the four arithmetic operations. Let us check if all this can take us to an efficient, and readable solution.
⎯⎯⎯⎯⎯⎯ Chapters ⎯⎯⎯⎯⎯⎯
0:00 Do you feel like a coffee break?
0:11 Introducing the Countdown game and its rules
03:01 Introducing the Haskell algorithm translated to Java
04:44 Computing all the permutations of all the subsets
07:20 Splitting the sets to apply the four operations
08:53 Filtering the invalid operations
09:55 Computing the final result and the string of characters
10:21 Using Data Oriented Programming to model the data
12:05 Wrapping up this algorithm
14:49 Writing a bottom up algorithm leveraging Data Oriented Programming
17:32 Using Optional to discard invalid mapping operations
21:37 Implementing resolve() with an exhaustive switch and pattern matching
23:00 Using a Gatherer to inserting an element at a specific place in a sorted stream
27:18 Using anonymous classes and non-denotable types
28:23 Using the Gatherer in the final process
29:00 Making the algorithm efficient
30:59 Writing the final algorithm using Records
31:50 Comparing the two algorithms
32:33 That's it for today, talk to you soon!
⎯⎯⎯⎯⎯⎯ Resources ⎯⎯⎯⎯⎯⎯
Some amazing Countdown episodes!
More resources on Data Oriented Programming and other subjects covered in this JEP Café
Tags: #Java #Java21 #OpenJDK #JDK #JDK21 #JEPCafe #insidejava
⎯⎯⎯⎯⎯⎯ Chapters ⎯⎯⎯⎯⎯⎯
0:00 Do you feel like a coffee break?
0:11 Introducing the Countdown game and its rules
03:01 Introducing the Haskell algorithm translated to Java
04:44 Computing all the permutations of all the subsets
07:20 Splitting the sets to apply the four operations
08:53 Filtering the invalid operations
09:55 Computing the final result and the string of characters
10:21 Using Data Oriented Programming to model the data
12:05 Wrapping up this algorithm
14:49 Writing a bottom up algorithm leveraging Data Oriented Programming
17:32 Using Optional to discard invalid mapping operations
21:37 Implementing resolve() with an exhaustive switch and pattern matching
23:00 Using a Gatherer to inserting an element at a specific place in a sorted stream
27:18 Using anonymous classes and non-denotable types
28:23 Using the Gatherer in the final process
29:00 Making the algorithm efficient
30:59 Writing the final algorithm using Records
31:50 Comparing the two algorithms
32:33 That's it for today, talk to you soon!
⎯⎯⎯⎯⎯⎯ Resources ⎯⎯⎯⎯⎯⎯
Some amazing Countdown episodes!
More resources on Data Oriented Programming and other subjects covered in this JEP Café
Tags: #Java #Java21 #OpenJDK #JDK #JDK21 #JEPCafe #insidejava
Комментарии