I want to dive deeper into Java and have found streams to be pretty cool. Do you have any other concepts that work in the context of the exercises that are worth looking into? I am sure all those new Java versions are not just published to increment some number. There must be some exiting changes, right?
Since Java 8 to the present, here’s the most exciting features for me:
Switch Expressions - A new way to write switches where each case can yield something and make the whole switch statement be an expression.
Text Blocks - New syntax to write multi line strings.
Records - Classes that are intended to hold data and auto-implement some methods like equals, toString and hashCode. Reduces boilerplate and makes it easier to write simple classes.
Pattern Matching for instance of - When you have an if (obj instanceof SomeType x), Java will automatically cast obj into a variable x that will be of type SomeType inside the if statement. This is the basic use case, but It is more powerful than this, as it is performing a pattern match. Check the link if you are interested in seeing more advanced use cases.
Virtual Threads (Preview) - Lightweight threads for Java. Allows you to have “units of concurrency” in your program without actually creating more operating system threads. Brings a bit of the concurrency model of Go, Erlang and Elixir to Java. Still in preview.