Java celebrated its 25th birthday in 2020. Code written in 1995 stilll runs today, without even having to recompile it. This is one of the biggest reasons why Java has had such success in enterprises.
Over the years, we have seen lots of improvements to make Java code easier to work with. Inner classes came in Java 1.1. A proper collection framework joined us in Java 1.2. Java 5 gave us better type safety with generics.
But the biggest improvement for Java programmers came in Java 8 with Streams and Lambdas. We can now write Java code in the declarative style, rather than imperative. This expresses better the "what", rather than the "how" of the program logic.
Since Java 8, we have had a constant stream of improvements to the Java Programming Language. Records, sealed classes, pattern matching, local variable type inference, and many more. They all serve to make it easier to craft great Java code.
Unfortunately a lot of Java code bases are still stuck in the dark ages of Java 6. This needs refactoring.
In this one-day course we learn how and when to "refactor", focusing on the biggest improvement: Java Streams. However, we also show what else is new in the Java Programming Language.
This is a very hands-on course. Each section has exercises where we get to refactor an existing code base of a large ERP system with 330k LOC.
Here are some of the many things we will cover during this workshop:
How to refactor to streams and lambdas with and without IDE assistance The place of streams and lambdas in the history of the JDK What is a functional interface? The four core functional interface types found in the java.util.function package How the lambda notation is a shorthand for an anonymous inner class based on a functional interface The long and short forms that lambdas can take depending on their complexity Method references as a further simplification of certain forms of lambda How default and static methods in interfaces can use lambdas to improve generality, correctness and readability When it might be unsafe to use methods like Map.computeIfAbsent The concept of a stream and its relationship to iterable collections Why coding with streams follows the algorithm logic more naturally than using for/while loops How to create, transform and terminate streams using filters, mappings, matchers, collectors, reducers, etc Why we should use collectors rather than forEach to build collections from a stream Using the Optional class to avoid null checks, and how optionals are used with streams How to handle exceptions in lambdas using sneaky throws (without Lombok) How functional interfaces, streams and optionals are optimized for the primitive types int, long and double
Write your comment!
Access Permission Error
You do not have access to this product!
To download this product, follow these steps:
Please subscribe to the One Day VIP or higher plan. (Please click here to upgrade your account)