Book description
Enhance your development skills with Java's state-of-the-art features and projects to make your applications leaner and faster
Key Features
- Overcome the challenges involved in migrating to new versions of Java
- Discover how Oracle has bridged the gap between Java and native code
- Make the best use of new Java features and libraries in your applications
Book Description
With its new six-monthly release cadence, Java is moving forward faster. In addition to planned version releases, a lot of work is currently being undertaken on various Java projects at Oracle. In order to make best use of the new features in their applications and libraries, you must be well-versed with the most recent advancements.
Java 11 and 12 - New Features will take you through the latest developments in Java, right from variable type inference and simplified multithreading through to performance improvements, which are covered in depth to help you make your applications more efficient. This book explains the relevance and applicability of Java's new features, and answers your questions on whether to invest in migrating to new Java versions and when to migrate. You'll also get to grips with platform features, such as AppCDS and new garbage collectors, to tune and optimize your application-from reduced launch time and latency to improved performance and throughput.
By the end of this book, you will be equipped with a thorough understanding of the new features of Java 11, 12, and Project Amber, and possess the skills to apply them with a view to improving your application's performance.
What you will learn
- Study type interference and how to work with the var type
- Understand Class-Data Sharing, its benefits, and limitations
- Discover platform options to reduce your application's launch time
- Improve application performance by switching garbage collectors
- Get up to date with the new Java release cadence
- Define and assess decision criteria for migrating to a new version of Java
Who this book is for
If you're an executive or solutions architect responsible for technology selection or Java migration decisions, this Java book is for you. You'll also benefit from this book if you're a computer science enthusiast curious to learn about the latest and upcoming Java features. This book will help you migrate your solutions from Java 8 or older to the latest Java release.
Table of contents
- Title Page
- Copyright and Credits
- About Packt
- Contributors
- Preface
- Section 1: JDK 10
-
Type Inference
- What is type inference?
-
Type inference with var
- Compulsory non-null initialization
- Local variables
- Code check – part 1
- Using var with primitive data types
- Type inference with derived classes
- Type inference with interfaces
- Using var with arrays
- Type inference with generics
- Code check – part 2
- Passing inferred variables to a method
- Reassigning values to inferred variables
- Explicit casting with inferred variables
- Assigning null with explicit casting
- Type inference in previous versions of Java
- Challenges
- Type inference versus dynamic binding
- Summary
- AppCDS
- Garbage Collector Optimizations
-
Miscellaneous Improvements in JDK 10
- Technical requirements
-
Mapping JDK 10 features with scopes and JEPs
- Consolidating the JDK forest into a single repository
- Thread-local handshakes
- Removal of the Native-Header Generation Tool (javah)
- Additional Unicode language-tag extensions
- Heap allocation on alternative memory devices
- The experimental Java-based JIT compiler
- Root certificates
- Time-based release versioning
- Summary
- Section 2: JDK 11
- Local Variable Syntax for Lambda Parameters
- Epsilon GC
- The HTTP Client API
- ZGC
- Flight Recorder and Mission Control
-
Miscellaneous Improvements in JDK 11
- Technical requirements
- Listing the JEPs that are used in this chapter
- Nest-based access control
- Dynamic class-file constants
- Improving AArch64 intrinsics
- Removing the Java EE and CORBA modules
- A key agreement with Curve25519 and Curve448
- Unicode 10
- ChaCha20 and Poly1305 cryptographic algorithms
- Launching single file source code programs
- TLS 1.3
- Deprecating the Nashorn JavaScript engine
- JEP 336 – deprecating the pack200 tools and API
- Summary
- Section 3: JDK 12
-
Switch Expressions
- Technical requirements
- Issues with traditional switch constructs
- Using switch expressions
- Defining local variables in a switch branch
- Another syntax for switch expressions
- Comparing break with break <return value>
- A preview language feature
- Exhaustive cases
- What can a switch branch execute other than returning a value?
- How not to use labels and continue in switch expressions
- Summary
- Miscellaneous Improvements in JDK 12
- Section 4: Project Amber
- Enhanced Enums in Project Amber
-
Data Classes and Their Usage
- An introduction to data classes
-
Diving into data classes
- Example of syntax and semantics
- The aggregate and exploded forms of data classes
- Limitations
- Examples from the past – changes to define enums
- Pattern matching with data classes
- Encapsulating the state
- Abstract and non-abstract data classes
- Data classes and inheritance
- Extending an abstract data class
- Implementing interfaces
- Additional variables
- Overriding implicit behaviors
- Additional methods and constructors
- Mutability
- Summary
- Raw String Literals
- Lambda Leftovers
- Pattern Matching
- Other Books You May Enjoy
Product information
- Title: Java 11 and 12 - New Features
- Author(s):
- Release date: March 2019
- Publisher(s): Packt Publishing
- ISBN: 9781789133271
You might also like
book
Mastering Java 11 - Second Edition
Update your Java knowledge with the latest features of Java 11, such as the low-Overhead Garbage …
book
Core Java, Volume II--Advanced Features, 11th Edition
Core Java® has long been recognized as the leading, no-nonsense tutorial and reference for experienced programmers …
video
Design Patterns in Java
In this Design Patterns in Java training course, expert author Petter Graff teaches you about the …
video
Design Patterns in Java
Design Patterns in Java LiveLessons is a clear, concise introduction to one of the most important …