Clear, Concise Guide to the Core Language and Libraries--Updated through Java 17
Modern Java introduces major enhancements that impact the core Java technologies and APIs at the heart of the Java platform. Many old Java idioms are no longer needed, and new features and programming paradigms can make you far more effective. However, navigating these changes can be challenging.
Core Java for the Impatient, Third Edition, is a complete yet concise guide that reflects all changes through Java SE 17, Oracle's latest Long-Term Support (LTS) release. Written by Cay S. Horstmann--author of the classic two-volume Core Java--this indispensable tutorial offers a faster, easier pathway for learning modern Java.
Horstmann covers everything working developers need to know, including the powerful concepts of lambda expressions and streams, modern constructs such as records and sealed classes, and sophisticated concurrent programming techniques. Given the size and scope of Java 17, there's plenty to cover, but it's presented in small chunks organized for quick access and easy understanding, with plenty of practical insights and sample code to help you quickly apply all that's new.
Test code as you create it with JShell
Improve your object-oriented design with records and sealed classes
Effectively use text blocks, switch expressions, and pattern matching
Understand functional programming with lambda expressions
Streamline and optimize data management with the Streams API
Use modern library features and threadsafe data structures to implement concurrency reliably
Work with the modularized Java API and third-party modules
Take advantage of API improvements for working with collections, input/output, regular expressions, and processes
Learn the APIs for date/time processing and internationalization
Whether you're an experienced developer just getting started with modern Java, or have been programming with Java for years, this guide will help you write more robust, efficient, and secure Java code.
Register your book for convenient access to downloads, updates, and/or corrections as they become available. See inside book for details.
Author(s): Cay Horstmann,
Publisher: Pearson Education, Limited
Year: 2023
Language: English
Pages: 576
Cover Page
About This eBook
Halftitle Page
Title Page
Copyright Page
Pearson’s Commitment to Diversity, Equity, and Inclusion
Dedication Page
Contents
Preface
Acknowledgments
About the Author
Chapter 1. Fundamental Programming Structures
1.1 Our First Program
1.2 Primitive Types
1.3 Variables
1.4 Arithmetic Operations
1.5 Strings
1.6 Input and Output
1.7 Control Flow
1.8 Arrays and Array Lists
1.9 Functional Decomposition
Exercises
Chapter 2. Object-Oriented Programming
2.1 Working with Objects
2.2 Implementing Classes
2.3 Object Construction
2.4 Records
2.5 Static Variables and Methods
2.6 Packages
2.7 Nested Classes
2.8 Documentation Comments
Exercises
Chapter 3. Interfaces and Lambda Expressions
3.1 Interfaces
3.2 Static, Default, and Private Methods
3.3 Examples of Interfaces
3.4 Lambda Expressions
3.5 Method and Constructor References
3.6 Processing Lambda Expressions
3.7 Lambda Expressions and Variable Scope
3.8 Higher-Order Functions
3.9 Local and Anonymous Classes
Exercises
Chapter 4. Inheritance and Reflection
4.1 Extending a Class
4.2 Inheritance Hierarchies
4.3 Object: The Cosmic Superclass
4.4 Enumerations
4.5 Runtime Type Information and Resources
4.6 Reflection
Exercises
Chapter 5. Exceptions, Assertions, and Logging
5.1 Exception Handling
5.2 Assertions
5.3 Logging
Exercises
Chapter 6. Generic Programming
6.1 Generic Classes
6.2 Generic Methods
6.3 Type Bounds
6.4 Type Variance and Wildcards
6.5 Generics in the Java Virtual Machine
6.6 Restrictions on Generics
6.7 Reflection and Generics
Exercises
Chapter 7. Collections
7.1 An Overview of the Collections Framework
7.2 Iterators
7.3 Sets
7.4 Maps
7.5 Other Collections
7.6 Views
Exercises
Chapter 8. Streams
8.1 From Iterating to Stream Operations
8.2 Stream Creation
8.3 The filter, map, and flatMap Methods
8.4 Extracting Substreams and Combining Streams
8.5 Other Stream Transformations
8.6 Simple Reductions
8.7 The Optional Type
8.8 Collecting Results
8.9 Collecting into Maps
8.10 Grouping and Partitioning
8.11 Downstream Collectors
8.12 Reduction Operations
8.13 Primitive Type Streams
8.14 Parallel Streams
Exercises
Chapter 9. Processing Input and Output
9.1 Input/Output Streams, Readers, and Writers
9.2 Paths, Files, and Directories
9.3 HTTP Connections
9.4 Regular Expressions
9.5 Serialization
Exercises
Chapter 10. Concurrent Programming
10.1 Concurrent Tasks
10.2 Asynchronous Computations
10.3 Thread Safety
10.4 Parallel Algorithms
10.5 Threadsafe Data Structures
10.6 Atomic Counters and Accumulators
10.7 Locks and Conditions
10.8 Threads
10.9 Processes
Exercises
Chapter 11. Annotations
11.1 Using Annotations
11.2 Defining Annotations
11.3 Standard Annotations
11.4 Processing Annotations at Runtime
11.5 Source-Level Annotation Processing
Exercises
Chapter 12. The Date and Time Api
12.1 The Time Line
12.2 Local Dates
12.3 Date Adjusters
12.4 Local Time
12.5 Zoned Time
12.6 Formatting and Parsing
12.7 Interoperating with Legacy Code
Exercises
Chapter 13. Internationalization
13.1 Locales
13.2 Number Formats
13.3 Currencies
13.4 Date and Time Formatting
13.5 Collation and Normalization
13.6 Message Formatting
13.7 Resource Bundles
13.8 Character Encodings
13.9 Preferences
Exercises
Chapter 14. Compiling and Scripting
14.1 The Compiler API
14.2 The Scripting API
Exercises
Chapter 15. The Java Platform Module System
15.1 The Module Concept
15.2 Naming Modules
15.3 The Modular “Hello, World!” Program
15.4 Requiring Modules
15.5 Exporting Packages
15.6 Modules and Reflective Access
15.7 Modular JARs
15.8 Automatic Modules
15.9 The Unnamed Module
15.10 Command-Line Flags for Migration
15.11 Transitive and Static Requirements
15.12 Qualified Exporting and Opening
15.13 Service Loading
15.14 Tools for Working with Modules
Exercises
Index
Code Snippets