Skip to content
  • Sign In
  • Try Now
View all events
Java

Making New Java Features Work For You

Published by O'Reilly Media, Inc.

Intermediate content levelIntermediate

Building robust, powerful applications with Java 9-19 and beyond

In this course, you’ll:

  • Learn the latest features in Java
  • Understand how to build clearer, more manageable code by using functional features such as streams, lambda expressions, and method references
  • Discover how features such as local variable type inference, sealed classes, switch statements, and records can help your company adopt new programming idioms in Java

Course description

Every six months, Oracle releases a new major version of Java. As a result, new language features appear frequently, and many of the most recent ones change the basic idioms for Java programming. From functional features like streams, lambdas, and method references to more recent capabilities like records, sealed classes, and pattern matching, the way Java is written has changed significantly in the last several years.

Join expert Kenneth Kousen to discover what new features are available and how to combine them to build robust, powerful Java applications.

Hands-on learning with interactive sandboxes

All exercises and labs will take place within an O'Reilly interactive sandbox—a complete development environment that's preconfigured with everything you need. There's nothing to install or configure; just click a link and get started!

What you’ll learn and how you can apply it

  • Use sealed classes and interfaces to expect a limited hierarchy of types and discover how that works with pattern matching in switch statements to simplify your code
  • Map records to JSON data structures and parse code into and out of them
  • Simplify the creation of new lists, sets, and maps with the new collection factory methods

This live event is for you because...

  • You're a Java developer who needs to know what new features have been added in the last few releases.
  • You maintain Java installations in a commercial environment and must decide whether an upgrade is appropriate.
  • You're a developer in another JVM-based language who wants to know how the underlying Java Virtual Machine has changed.

Prerequisites

  • A working knowledge of Java 7 or above

Recommended preparation:

Recommended follow-up:

Schedule

The time frames are only estimates and may vary according to how the class is progressing.

Overview (10 minutes)

  • Presentation: The release schedule for Java; differences between the Oracle JDK and the open source version; built OpenJDK implementations; where to locate the most recent JSRs and discussions

Lambda expressions, method references, and streams (30 minutes)

  • Presentation: Concepts of functional programming; syntax for lambdas and method references; streams with intermediate and terminal operations

Static and default methods in interfaces (35 minutes)

  • Presentation: Implementing and overriding default methods in interfaces; static methods in interfaces; using the super keyword with interfaces
  • Break

The Optional data type (15 minutes)

  • Presentation: Wrapping values in Optional; processing Optional using orElse, orElseGet, and orElseThrow; differences between map and flatMap

Collection factory methods (15 minutes)

  • Presentation: Using List.of, Set.of, Map.of, and Map.ofEntries; unmodifiable collections; dealing with nulls

JShell, single file execution, and the Java web server (25 minutes)

  • Presentation: Command-line processes like the JShell REPL; executing files without compiling; the simple Java web server
  • Break

Local variable type inference (15 minutes)

  • Presentation: The new var "reserved type name"; rules for var usage; recommended practices

Switch expressions, text blocks, and pattern matching (30 minutes)

  • Presentation: Exhaustive switch statements with multiple cases; pattern matching for instanceof and switch; multiline strings

Records and the HttpClient API (25 minutes)

  • Presentation: Access RESTful web services with the new HttpClient; record syntax and generated methods; parsing JSON data into records
  • Break

Sealed classes and interfaces (15 minutes)

  • Presentation: Creating restricted type hierarchies

Putting everything together (15 minutes)

  • Presentation: Implement a larger example that incorporates records, pattern matching, sealed interfaces, local variable type inference, collection factory methods, and other features into a single system

Wrap-up and Q&A (10 minutes)

Your Instructor

  • Ken Kousen

    Ken Kousen is the author of the Kotlin Cookbook (O'Reilly), Modern Java Recipes (O'Reilly), Gradle Recipes for Android (O’Reilly), and Making Java Groovy (Manning), as well as O’Reilly video courses in Android, Groovy, Gradle, advanced Java, and Spring. A JavaOne Rock Star, he’s a regular speaker on the No Fluff Just Stuff conference tour and has spoken at conferences all over the world. Through his company, Kousen I.T., Inc., he’s taught software development training courses to thousands of students.

    linkedinXlinksearch