Video description
"A comprehensive and practical introduction to the modern features of the latest Java releases with excellent examples!"
Oleksandr Mandryk, EPAM Systems
Manning's bestselling Java 8 book has been revised for Java 9 and 10! In Modern Java in Action, you'll build on your existing Java language skills with the newest features and techniques.
Modern applications take advantage of innovative designs, including microservices, reactive architectures, and streaming data. Modern Java features like lambdas, streams, and the long-awaited Java Module System make implementing these designs significantly easier. It’s time to upgrade your skills and meet these challenges head on!
Modern Java in Action connects new features of the Java language with their practical applications. Using crystal-clear examples and careful attention to detail, this book respects your time. It will help you expand your existing knowledge of core Java as you master modern additions like the Streams API and the Java Module System, explore new approaches to concurrency, and learn how functional concepts can help you write code that’s easier to read and maintain.
Inside:- Thoroughly revised edition of Manning’s bestselling Java 8 in Action
- New features in Java 8, Java 9, and beyond
- Streaming data and reactive programming
- The Java Module System
Written for developers familiar with core Java features.
Raoul-Gabriel Urma is CEO of Cambridge Spark. Mario Fusco is a senior software engineer at Red Hat. Alan Mycroft is a University of Cambridge computer science professor; he cofounded the Raspberry Pi Foundation.
My Java code improved significantly after reading this book. I was able to take the clear examples and immediately put them into practice.
Holly Cummins, IBM
Hands-on Java 8 and 9, simply and elegantly explained.
Deepak Bhaskaran, Salesforce
A lot of great examples and use cases for streams, concurrency, and reactive programming.
Rob Pacheco, Synopsys
NARRATED BY SARAH DAWE AND LOU FERNANDEZ
Table of Contents
Part 1. Fundamentals
Ch 1. Java 8, 9, 10, and 11: what’s happening?
So, what’s the big story?
Why is Java still changing?
Stream processing
Parallelism and shared mutable data
Functions in Java
Passing code: an example
Streams
Default methods and Java modules
Other good ideas from functional programming
Ch 2. Passing code with behavior parameterization
Coping with changing requirements
Behavior parameterization
Tackling verbosity
Real-world examples
Ch 3. Lambda expressions
Lambdas in a nutshell
Where and how to use lambdas
Putting lambdas into practice: the execute-around pattern
Using functional interfaces
Type checking, type inference, and restrictions
Type inference
Method references
Putting lambdas and method references into practice
Useful methods to compose lambda expressions
Similar ideas from mathematics
Part 2. Functional-style data processing with streams
Ch 4. Introducing streams
What are streams?
Getting started with streams
Streams vs. collections
External vs. internal iteration
Stream operations
Ch 5. Working with streams
Filtering
Mapping
Finding and matching
Reducing
Maximum and minimum
Putting it all into practice
Numeric streams
Putting numerical streams into practice: Pythagorean triples
Building streams
Streams from functions: creating infinite streams!
Overview
Ch 6. Collecting data with streams
Collectors in a nutshell
Reducing and summarizing
Generalized summarization with reduction
Grouping
Collecting data in subgroups
Partitioning
The Collector interface
Putting them all together
Developing your own collector for better performance
Ch 7. Parallel data processing and performance
Parallel streams
Measuring stream performance
Using parallel streams correctly
The fork/join framework
Best practices for using the fork/join framework
Spliterator
Implementing your own Spliterator
Part 3. Effective programming with streams and lambdas
Ch 8. Collection API enhancements
Collection factories
Working with List and Set
Working with Map
Remove patterns
Improved ConcurrentHashMap
Ch 9. Refactoring, testing, and debugging
Improving code readability
From lambda expressions to method references
Refactoring object-oriented design patterns with lambdas
Observer
Testing lambdas
Debugging
Ch 10. Domain-specific languages using lambdas
Domain-specific languages using lambdas
A specific language for your domain
Different DSL solutions available on the JVM
Small DSLs in modern Java APIs
Patterns and techniques to create DSLs in Java
Function sequencing with lambda expressions
Real World Java 8 DSL
Spring Integration
Part 4. Everyday Java
Ch 11. Using Optional as a better alternative to null
How do you model the absence of a value?
Problems with null
Introducing the Optional class
Patterns for adopting Optionals
Chaining Optional objects with flatMap
Manipulating a stream of optionals
Combining two Optionals
Practical examples of using Optional
Ch 12. New Date and Time API
LocalDate, LocalTime, LocalDateTime, Instant, Duration, and Period
Combining a date and a time
Manipulating, parsing, and formatting dates
Working with different time zones and calendars
Ch 13. Default methods
Default methods
Evolving APIs
Default methods in a nutshell
Usage patterns for default methods
Resolution rules
Diamond problem
Ch 14. The Java Module System
The driving force: reasoning about software
Why the Java Module System was designed
Monolithic JDK
Java modules: the big picture
Developing an application with the Java Module System
Working with several modules
Compiling and packaging
Module declaration and clauses
Part 5. Enhanced Java concurrency
Ch 15. Concepts behind CompletableFuture and reactive programming
Concepts behind CompletableFuture and reactive programming
Evolving Java support for expressing concurrency
Executors and thread pools
Other abstractions of threads: non-nested with method calls
Synchronous and asynchronous APIs
Reactive-style API
Reality check
The box-and-channel model
CompletableFuture and combinators for concurrency
Publish-subscribe and reactive programming
Backpressure
Reactive systems vs. reactive programming
Ch 16. CompletableFuture: composable asynchronous programming
Simple use of Futures
Implementing an asynchronous API
Making your code nonblocking
Looking for the solution that scales better
Pipelining asynchronous tasks
Composing synchronous and asynchronous operations
Combining two CompletableFutures: dependent and independent
Reacting to a CompletableFuture completion
Ch 17. Reactive programming
The Reactive Manifesto
Reactive at application level
Reactive streams and the Flow API
Creating your first reactive application
Using the reactive library RxJava
Creating and using an Observable
Transforming and combining Observables
Part 6. Functional programming and future Java evolution
Ch 18. Thinking functionally
Implementing and maintaining systems
What’s functional programming?
Referential transparency
Recursion vs. iteration
Ch 19. Functional programming techniques
Functions everywhere
Persistent data structures
Using a functional approach
Lazy evaluation with streams
Your own lazy list
Pattern matching
Miscellany
Ch 20. Blending OOP and FP: Comparing Java and Scala
Introduction to Scala
Basic data structures: List, Set, Map, Tuple, Stream, Option
Functions
Classes and traits
Ch 21. Conclusions and where next for Java
Review of Java 8 features
CompletableFuture
The Java 9 module system
What’s ahead for Java?
Richer forms of generics
Value types
Moving Java forward faster
App A. Miscellaneous language updates
Miscellaneous language updates
App B. Miscellaneous library updates
Collections
Concurrency
Arrays
App C. Performing multiple operations in parallel on a stream
Forking a stream
Developing the ForkingStreamConsumer and the BlockingQueueSpliterator
App D. Lambdas and JVM bytecode
Anonymous classes