
Cruising Along with Java
Description
Alles über E-Books | Antworten auf Fragen rund um E-Books, Kopierschutz und Dateiformate finden Sie in unserem Info- & Hilfebereich.
Java is on a fast-paced development schedule that brings with it improved design capabilities and enhancements for application security. Learn about the changes to Java, from version 9 to 24, and apply new features to build enterprise applications faster and with fewer errors. Get up to speed on how to make your code concise, expressive, and less error prone, and create better OO programs with the newest features. Modularize and create asynchronous applications with ease and proper error handling. This book contains twelve chapters that dive deep into the features, using plenty of examples for you to practice along with.
Java is changing quickly - don't be left behind. This book will keep you up to date on the amazing capabilities of the Java language introduced between versions 9 and 24. Whether you are using Java 8 or one of the newer versions of Java, this book will serve as your practical guide to explore and apply the features in these versions of Java.
Learn to properly use type inference and avoid its pitfalls. Use text blocks to write elegant multiline strings and embed XML and JSON documents in code. Design better OO code with records and sealed classes, and along the way, learn proper ways to apply these new ideas. Reduce verbosity and hidden errors in code using switch expressions and pattern matching syntax. Take your upgrade journey further by modularizing your Java code, to make it more secure and manage dependencies clearly. Leverage those capabilities to more easily and dynamically discover services. Learn to create highly performant and resilient asynchronous applications, using the brand new virtual threads (fibers) and structured concurrency.
Don't tolerate clumsy old Java code; instead, benefit from the significant changes to the language in versions 9 through 24.
What You Need:
To make use of all the features in this book, you'll need at least Java 24.
More details
Person
Content
- Cover
- Table of Contents
- Acknowledgments
- Preface
- What's in This Book?
- Who's This Book For?
- Java Version Used in This Book
- How to Read the Code Examples
- Online Resources
- 1. The Evolution of Java
- Java Is Agile
- Fast-Paced Change
- Recent Changes to Java
- Moving Ahead from an LTS
- Cruising Along with Java
- Part I-Syntax Sugar
- 2. Using Type Inference
- Type Inference and Java
- Generics and Type Witness
- Diamond Operator Enhancements
- Lambda Expressions Parameters Type Inference
- Local Variable Type Inference
- Using Type Inference with for and try
- var: Not a Type nor a Keyword
- Targeted Intersection Types
- Extent of Type Inference
- Mind the Inference
- Wrapping Up
- 3. Reducing Clutter with Text Blocks
- From Noisy to Nice
- Embedding Strings
- Smart Indentations
- Trailing Spaces and Special Escapes
- Creating XML Documents Using Text Blocks
- Creating JSON Output Using Text Blocks
- Wrapping Up
- Part II-Design Aid
- 4. Programming with Records
- From Verbose to Succinct
- Components, Fields, Getters, and Metadata
- Extent of Immutability
- Built-in Methods
- Implementing Interfaces
- Restrictions for the Greater Good
- Considering a Custom Canonical Constructor?
- Preferring the Compact Constructor
- Creating a Custom Noncanonical Constructor
- (Local) Records as Tuples
- Wrapping Up
- 5. Designing with Sealed Classes and Interfaces
- Need for a Closed Hierarchy
- Using sealed
- Sealed Related Metadata
- Using the permits Clause
- Constraints on the Subclasses
- Wrapping Up
- Part III-Fluent Expressions
- 6. Switching to Switch Expression
- From Statements to Expressions
- Using Multiple Labels in a Case
- Cases with Non-expressions
- Completeness of a switch Expression
- Wrapping Up
- 7. Using Powerful Pattern Matching
- Pattern Matching with instanceof
- Using Type Matching
- Matching null
- Guarded Patterns
- Dominance Check
- Completeness Check
- Completeness Check and Sealed Classes/Interfaces
- Deciding to Use default or Not
- Pattern Matching Primitive Types
- Destructuring Records When Pattern Matching
- Type Inference with Destructuring Records
- Unnamed Variables in Pattern Matching
- Wrapping Up
- Part IV-Modularization
- 8. Modularizing Your Java Applications
- Maven, Gradle, and Modularization
- Modules and the Benefits of Modularization
- Modularized Java
- Starting with a Legacy Application
- Perils of the Existing Design
- Modularizing the Space Station Application
- Architectural Constraints Promoted by Modules
- Wrapping Up
- 9. Working with Modules
- Exploring the Module Metadata
- Defining APIs in a Modular Way
- Targeted Linking Using jlink
- Wrapping Up
- 10. Creating Plug-ins with ServiceLoader
- The Plug-in Architecture
- Defining a Specification Module
- Creating a Client Module
- Implementing a Plug-in
- Implementing Additional Plug-ins
- Reloading the Implementations
- Functional Style Iteration
- Wrapping Up
- Part V-Custom Functional Pipeline Steps
- 11. Extending Functional Pipelines with Gatherers
- Why Do We Need Gatherers?
- Creating Custom Steps Using the gather() Method
- Using Built-in Gatherers
- Wrapping Up
- 12. Creating Custom Gatherers
- The Machinery Behind the gather() Method
- Flavors of Gatherers
- Creating Sequential Stateless Gatherers
- Creating Sequential Stateful Gatherers
- Creating Parallelizable Stateless Gatherers
- Creating Parallelizable Stateful Gatherers
- Wrapping Up
- Bibliography
- Index
- - SYMBOLS -
- - A -
- - B -
- - C -
- - D -
- - E -
- - F -
- - G -
- - H -
- - I -
- - J -
- - L -
- - M -
- - N -
- - O -
- - P -
- - Q -
- - R -
- - S -
- - T -
- - U -
- - V -
- - W -
- - X -
- - Y -
System requirements
File format: ePUB
Copy protection: Watermark-DRM (Digital Rights Management)
System requirements:
- Computer (Windows; MacOS X; Linux): Use a reading software that can process the file format ePUB: e.g., Adobe Digital Editions or FBReader – both free (see eBook Help).
- Tablet/Smartphone (Android; iOS): Before downloading, install the free app Adobe Digital Editions (see eBook Help).
- E-reader: Bookeen, Kobo, Pocketbook, Sony, Tolino and many more (not Kindle).
The file format ePUB works well for novels and non-fiction books – i.e., „flowing” text without complex layout. On an e-reader or smartphone, line and page breaks automatically adjust to fit the small displays.
This eBook uses Watermark-DRM, a „soft” copy protection. This means that there are no technical restrictions to prevent illegal distribution. However, there is a personalised watermark embedded in the eBook that can be used to identify the purchaser of the eBook in the event of misuse and to provide evidence for legal purposes.
For more information, see our eBook Help page.