Leanpub Header

Skip to main content

Modern Java - The Mindset Shift

Modern Java - The Mindset Shift

Modern Java is more than a collection of new language features—it is a shift from implementing mechanics to expressing intent. Learn how records, sealed types, pattern matching, streams, modules, virtual threads, and other modern capabilities help you build Java software that is clearer, safer, and easier to evolve.

Minimum price

$19.00

$29.00

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

PDF
EPUB
About

About

About the Book

Modern Java is not defined by a version number. It is a way of designing software that expresses intent clearly, reduces accidental complexity, and allows the compiler and platform to enforce correctness.

Modern Java – The Mindset Shift is written for developers who already understand Java but want to move beyond verbose, implementation-focused habits. Rather than presenting language features as isolated syntax, the book explains the design ideas behind them and shows how they change the way software is modelled, composed, and maintained.

Through focused explanations, practical code examples, and more than fifty diagrams, you will explore:

• Functional interfaces and behavior as a value
• Records, sealed types, interfaces, and modern domain modelling
• Pattern matching and expressive decision logic
• Java modules and enforceable architectural boundaries
• Exceptions, Optional, and explicit failure modelling
• Primitives, wrappers, and performance-aware representation
• Concurrency foundations, CompletableFuture, structured concurrency, and virtual threads
• Collections as ownership boundaries
• Declarative data transformations and stream pipelines
• Modern date and time modelling

The book repeatedly asks one important question:

What used to be the developer’s responsibility—and whose responsibility is it now?

The answer reveals the direction of modern Java: away from manually implementing mechanics and toward declaring intent. The result is not merely shorter code, but software that is easier to understand, review, test, and evolve.

This is not an introductory Java book or a catalog of release-by-release features. It is a practical guide to thinking differently about Java and using its modern capabilities as design tools.

Author

About the Author

Pradeep Kumar Laxminarayana

Pradeep Kumar L. is a software architect, author, and corporate technology trainer with more than two decades of experience designing and building enterprise applications.

His work spans Java, Spring, Spring Boot, microservices, cloud-native architecture, AWS, containers, Kubernetes, DevOps, and distributed systems. Over the years, he has worked closely with developers and engineering teams, helping them move beyond framework usage toward stronger architectural judgment and clearer software design.

He is the author of Modern Java — The Mindset Shift and Spring Boot — On Autopilot.

His writing focuses on a practical idea: modern development is not about memorizing more syntax or annotations. It is about understanding the decisions your tools and frameworks make for you, expressing intent clearly, and knowing when to rely on defaults, when to tune them, and when to take control.

Through his books, he aims to help developers build not just working software, but software that is easier to understand, maintain, and evolve.

Contents

Table of Contents

Table of Contents

Chapter 1: The Mindset Shift
  • Why Modern Java
  • The Compiler Already Knew
  • What Changed and What Did Not
Chapter 2: Functional Interfaces
  • Behavior as a Value
  • From Anonymous Classes to Lambdas
  • The Functional Contracts
  • Composing the Pipeline
  • The Vocabulary in Action
  • What Did Not Change
Chapter 3: Modern Type Design
  • Why Inheritance Lost Its Default
  • Interfaces as Capabilities
  • Records as Values
  • Sealed Types for Closed Domains
  • Abstract Classes for Algorithms
  • Default Methods for Evolution
  • Designing a Refund Processing API
Chapter 4: Pattern Matching
  • From Cast to Pattern
  • The Sealed Switch
  • Record Patterns
  • Guarded Patterns and Null
  • Combining the Capabilities
  • A Vocabulary of Patterns
  • Choosing the Right Construct
Chapter 5: Java Modules
  • Why Packages Fail as Boundaries
  • exports — Declaring Public API
  • exports … to — Qualified Exports
  • requires — Declaring Dependencies
  • opens — Reflective Access
  • Contract-Based Services
  • A Modular Payment Platform
  • When Modules Are the Wrong Tool
  • Common Pitfalls
Chapter 6: Exception Handling
  • The Unverified Default
  • Checked vs Unchecked Exceptions
  • Optional Represents Absence
  • Try-with-Resources Cleanup
  • Exhaustive Failure Handling
  • Chaining and Cause Preservation
  • Exception Propagation by Layer
  • When Null Is Deliberate
  • Exceptions vs Sealed Results
  • Designing Refund Processing
  • Choosing the Right Construct
Chapter 7: Primitives and Wrappers
  • Two Type Worlds, One Language
  • Crossing Once via Primitive Streams
  • Primitive Functional Interfaces
  • Wrappers as Modelling Tools
  • Unboxing and NullPointerException
  • Optional for Primitives
  • Choosing the Right Representation
Chapter 8: Concurrency Foundations
  • Why Applications Are Concurrent
  • Shared State and Race Conditions
  • Immutability and Stateless Design
  • Synchronization and Visibility
  • Executors and Thread Pools
  • Atomics and Lock-Free Coordination
  • ThreadLocal and Isolated State
  • Concurrent Collections
  • When to Avoid Manual Concurrency
Chapter 9: Modern Concurrency
  • From Choreography to Orchestration
  • Composing the Workflow
  • Timeouts and Failures
  • Limits of Unstructured Composition
  • Structured Concurrency
  • Virtual Threads and Cheap Blocking
  • Choosing the Right Abstraction
  • When Not to Use These Abstractions
  • End-to-End Settlement Pipeline
Chapter 10: Collections
  • Collections as Ownership Boundaries
  • Shared Mutable Collection Risks
  • Encapsulating Mutation
  • Defensive Copying
  • Immutable Collection Factories
  • Stream Pipeline Results
  • Views vs Immutable Collections
  • Empty Collections, Not Null
  • Concurrency and Immutability
  • Safe Collection APIs
  • Ownership Decision Tree
  • When Not to Prefer Immutability
  • The Ownership Spine
Chapter 11: Declarative Data Transformations
  • External to Internal Iteration
  • Primitive Boundary Discipline
  • Classification by Partitioning
  • Classification by Grouping
  • Grouping with Aggregation
  • Multi-Level Classification
  • Pipeline Composition
  • Execution Strategy Boundaries
Chapter 12: Streams
  • Laziness as Ownership
  • Sources Beyond Collections
  • Behaviour Across a Pipeline
  • Pipeline Discipline
  • Primitive and Wrapper Discipline
  • Composing Streams
  • Concurrency Patterns
  • Full Pipeline Composition
Appendix A: Functional Interfaces
  • What Makes an Interface Functional
  • The Four Core Contracts
  • The Two-Argument Variants
  • Specialised Variants
  • Standard Library Inventory
  • Primitive Specialisations
  • Pre-Java 8 Functional Interfaces
  • Contracts in Standard Java APIs
Appendix B: Modern Date and Time
  • Why Time Is Harder Than Numbers
  • Stop Using the Legacy APIs
  • Human Time vs Machine Time
  • Choosing the Right Abstraction
  • Instant, Offset, and Zoned Time
  • Time Zones and Correct Modelling
  • Duration and Period
  • ChronoUnit and TimeUnit
  • Formatting and Parsing
  • Clock Abstraction and Testability
  • Database Interaction
  • Common Time Bugs
  • Legacy Interoperability

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earned over $15 million writing, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub