Pattern Matching

As a Java programmer, imagine having the option of skipping usage of the instanceof operator and explicit casting operators to retrieve a value from your objects. Pattern matching (JDK Enhancement Proposals (JEP) 305) addresses this pain point by adding type test patterns and constant patterns. It enhances the Java programming language to introduce functionality that enables you to determine the type of instances and derived classes, and access their members without using explicit casting.

In this chapter, we'll cover the following topics:

  • Pattern matching
  • Type test patterns
  • Constant patterns
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.16.79.147