AI guide
# Core Java, Volume II: Advanced Features — Reading Guide
## 【One-Line Pitch】
The definitive advanced Java reference for experienced developers, covering streams, I/O, XML, networking, databases, and more—fully updated for Java 21. If you've mastered the language basics and need to build real-world, production-grade applications, this is your practical handbook.
## 【Book Arc】
- **Opening (~0%–9%)**: Front matter, copyright, and table of contents establish the book's scope—a second volume focused on professional libraries and APIs beyond core language features, with a companion website for errata and updates.
- **Early (~16%–28%)**: Preface and chapter tour explain the book's philosophy: chapters are largely independent, so readers can jump to any topic. The author outlines coverage of streams, I/O, XML, networking, databases, Swing, graphics, and native methods, with a note that UI programming has moved from "fundamental" to "advanced" status.
- **Early (~34%)**: Chapter 1 begins with the Stream API, introducing the "what, not how" paradigm—streams let you specify computations at a higher level than loops, enabling the library to optimize execution, including parallel processing.
- **Middle (~38%–44%)**: Stream fundamentals deepen: creating streams from collections, arrays, generators, and infinite sequences; understanding that streams don't store elements or mutate sources; and using operations like `filter` and `count` with both sequential and parallel streams.
- **Middle (~47%)**: Stream creation techniques expand—`Stream.iterate` for sequences, `ofNullable` for optional elements, and API methods like `String.lines`, `Pattern.splitAsStream`, and `Files.lines` that return streams directly.
## 【Key Takeaways】
- **Streams enable declarative data processing** (Early): The "what, not how" principle lets you express intent (e.g., "filter long words and count them") without prescribing execution order, allowing the library to optimize—including parallel execution via `parallelStream()`.
- **Streams differ fundamentally from collections** (Middle): Streams don't store elements, don't mutate their sources, and can be infinite or generated on demand—a conceptual shift that prevents common misuse.
- **Multiple stream creation patterns exist** (Middle): Collections use `.stream()`, arrays use `Stream.of` or `Arrays.stream(array, from, to)`, and infinite streams come from `generate` (supplier) or `iterate` (seed + unary operator).
- **Finite streams from infinite generators** (Middle): Adding a predicate to `Stream.iterate` creates bounded sequences—essential for controlling potentially endless data sources.
- **The Java API increasingly returns streams directly** (Middle): Methods like `String.lines()`, `Pattern.splitAsStream()`, `Scanner.tokens()`, and `Files.lines()` integrate streams into everyday file and text processing.
- **Resource management matters with file streams** (Middle): `Files.lines()` requires try-with-resources to properly close the underlying file—a practical detail that prevents resource leaks.
- **Parallelism is a one-word change** (Middle): Switching `.stream()` to `.parallelStream()` enables multi-core processing for suitable operations, but the book emphasizes this requires understanding when parallelization is safe and beneficial.
## 【Reading Tips】
- **Skip the front matter** (~0%–16%): Copyright pages and acknowledgments contain no technical content—jump straight to Chapter 1 unless you need the chapter overview in the tour section.
- **Deep-read Chapter 1 on Streams** (~34%–47%): This is the most conceptually dense material in the excerpts. Focus on understanding the stream pipeline model (source → intermediate operations → terminal operation) before moving to other chapters.
- **Use the book as a reference, not a cover-to-cover read**: The author explicitly states chapters are independent. Pick the topics relevant to your current project—networking, databases, XML—and consult specific sections as needed.
- **Pay attention to API summary boxes**: The book includes informal API descriptions after first use of each class/method, which are more readable than official documentation and include the JDK version where features were introduced.
- **Watch for Java 21 updates**: Since this edition targets Java 21, note the new APIs (like `availableLocales` returning a stream) and preview features marked with special icons—these signal what's current versus upcoming.
## 【Coverage Limits】
The excerpts cover the book's front matter, preface, chapter overview, and the beginning of Chapter 1 (Streams). Content on I/O, XML, networking, databases, Swing, graphics, and native methods is described in the table of contents but not covered in detail in this guide.
##
Passage locations
Excerpt 1
nformation Cover image: Leyland/Shutterstock Figures 3.3, 4.8: Mozilla Foundation Figures 4.1-4.5, 5.3, 5.4, 13.4: Microsoft Corporation Figure 4.6: USPS Fig...
View in text
Excerpt 2
nd to send suggestions for improvements for future editions. A Tour of This Book The chapters in this book are, for the most part, independent of each other....
View in text
Excerpt 3
a Kirsanova for copyediting the manuscript, and to Clovis L. Tondo for reviewing the final content. I wrote the book using HTML and CSS, and Prince ( https:/...
View in text
Excerpt 4
ers = Stream.iterate(BigInteger.ZERO, n -> n.add(BigInteger.ONE)); The first element in the sequence is the seed BigInteger.ZERO . The second element is f(se...
View in text