Published by Addison-Wesley Professional (September 15, 2017) © 2018

Cay Horstmann
    VitalSource eTextbook (Lifetime access)
    €36,99
    Adding to cart… The item has been added
    ISBN-13: 9780134694825

    Core Java SE 9 for the Impatient ,2nd edition

    Language: English

    An Accessible Guide to the Java Language and Libraries

     

    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 such as modularization make you far more effective. However, navigating these changes can be challenging.

     

    Core Java® SE 9 for the Impatient, Second Edition, is a complete yet concise guide that includes all the latest changes up to Java SE 9. 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. Given Java SE 9’s size and the scope of its enhancements, there’s plenty to cover, but it’s presented in small chunks organized for quick access and easy understanding.

     

    Horstmann’s practical insights and sample code help you quickly take advantage of all that’s new, from Java SE 9’s long-awaited “Project Jigsaw” module system to the improvements first introduced in Java SE 8, including lambda expressions and streams.

    • Use modules to simplify the development of well-performing complex systems
    • Migrate applications to work with the modularized Java API and third-party modules
    • Test code as you create it with the new JShell Read-Eval-Print Loop (REPL)
    • Use lambda expressions to express actions more concisely
    • Streamline and optimize data management with today’s Streams API
    • Leverage modern concurrent programming based on cooperating tasks
    • Take advantage of a multitude of API improvements for working with collections, input/output, regular expressions, and processes

    Whether you’re just getting started with modern Java or you’re an experienced developer, this guide will help you write tomorrow’s most robust, efficient, and secure Java code.


    Register your product at informit.com/register for convenient access to downloads, updates, and/or corrections as they become available.

    Preface xxi

    Acknowledgments xxiii

    About the Author xxv

     

    Chapter 1: Fundamental Programming Structures 1

    1.1 Our First Program 2

    1.2 Primitive Types 10

    1.3 Variables 14

    1.4 Arithmetic Operations 17

    1.5 Strings 24

    1.6 Input and Output 32

    1.7 Control Flow 36

    1.8 Arrays and Array Lists 43

    1.9 Functional Decomposition 52

    Exercises 54

     

    Chapter 2: Object-Oriented Programming 59

    2.1 Working with Objects 60

    2.2 Implementing Classes 65

    2.3 Object Construction 69

    2.4 Static Variables and Methods 74

    2.5 Packages 78

    2.6 Nested Classes 85

    2.7 Documentation Comments 90

    Exercises 95

     

    Chapter 3: Interfaces and Lambda Expressions 99

    3.1 Interfaces 100

    3.2 Static, Default, and Private Methods 105

    3.3 Examples of Interfaces 109

    3.4 Lambda Expressions 113

    3.5 Method and Constructor References 116

    3.6 Processing Lambda Expressions 119

    3.7 Lambda Expressions and Variable Scope 124

    3.8 Higher-Order Functions 127

    3.9 Local and Anonymous Classes 129

    Exercises 131

     

    Chapter 4: Inheritance and Reflection 135

    4.1 Extending a Class 136

    4.2 Object: The Cosmic Superclass 145

    4.3 Enumerations 154

    4.4 Runtime Type Information and Resources 159

    4.5 Reflection 168

    Exercises 177

     

    Chapter 5: Exceptions, Assertions, and Logging 181

    5.1 Exception Handling 182

    5.2 Assertions 193

    5.3 Logging 195

    Exercises 203

     

    Chapter 6: Generic Programming 207

    6.1 Generic Classes 208

    6.2 Generic Methods 209

    6.3 Type Bounds 210

    6.4 Type Variance and Wildcards 211

    6.5 Generics in the Java Virtual Machine 216

    6.6 Restrictions on Generics 220

    6.7 Reflection and Generics 226

    Exercises 229

     

    Chapter 7: Collections 235

    7.1 An Overview of the Collections Framework 236

    7.2 Iterators 240

    7.3 Sets 242

    7.4 Maps 243

    7.5 Other Collections 247

    7.6 Views 252

    Exercises 255

     

    Chapter 8: Streams 259

    8.1 From Iterating to Stream Operations 260

    8.2 Stream Creation 261

    8.3 The filter, map, and flatMap Methods 263

    8.4 Extracting Substreams and Combining Streams 264

    8.5 Other Stream Transformations 265

    8.6 Simple Reductions 266

    8.7 The Optional Type 267

    8.8 Collecting Results 271

    8.9 Collecting into Maps 273

    8.10 Grouping and Partitioning 274

    8.11 Downstream Collectors 275

    8.12 Reduction Operations 277

    8.13 Primitive Type Streams 279

    8.14 Parallel Streams 280

    Exercises 283

     

    Chapter 9: Processing Input and Output 287

    9.1 Input/Output Streams, Readers, and Writers 288

    9.2 Paths, Files, and Directories 298

    9.3 HTTP Connections 306

    9.4 Regular Expressions 310

    9.5 Serialization 319

    Exercises 325

     

    Chapter 10: Concurrent Programming 329

    10.1 Concurrent Tasks 330

    10.2 Asynchronous Computations 335

    10.3 Thread Safety 341

    10.4 Parallel Algorithms 348

    10.5 Threadsafe Data Structures 350

    10.6 Atomic Counters and Accumulators 354

    10.7 Locks and Conditions 357

    10.8 Threads 362

    10.9 Processes 366

    Exercises 371

     

    Chapter 11: Annotations 377

    11.1 Using Annotations 378

    11.2 Defining Annotations 383

    11.3 Standard Annotations 386

    11.4 Processing Annotations at Runtime 391

    11.5 Source-Level Annotation Processing 394

    Exercises 398

     

    Chapter 12: The Date and Time API 401

    12.1 The Time Line 402

    12.2 Local Dates 404

    12.3 Date Adjusters 407

    12.4 Local Time 409

    12.5 Zoned Time 410

    12.6 Formatting and Parsing 413

    12.7 Interoperating with Legacy Code 416

    Exercises 417

     

    Chapter 13: Internationalization 421

    13.1 Locales 422

    13.2 Number Formats 427

    13.3 Currencies 428

    13.4 Date and Time Formatting 429

    13.5 Collation and Normalization 431

    13.6 Message Formatting 433

    13.7 Resource Bundles 435

    13.8 Character Encodings 438

    13.9 Preferences 439

    Exercises 441

     

    Chapter 14: Compiling and Scripting 443

    14.1 The Compiler API 444

    14.2 The Scripting API 448

    14.3 The Nashorn Scripting Engine 452

    14.4 Shell Scripting with Nashorn 461

    Exercises 464

     

    Chapter 15: The Java Platform Module System 469

    15.1 The Module Concept 470

    15.2 Naming Modules 472

    15.3 The Modular “Hello, World!” Program 472

    15.4 Requiring Modules 474

    15.5 Exporting Packages 476

    15.6 Modules and Reflective Access 479

    15.7 Modular JARs 482

    15.8 Automatic Modules and the Unnamed Module 484

    15.9 Command-Line Flags for Migration 485

    15.10 Transitive and Static Requirements 487

    15.11 Qualified Exporting and Opening 489

    15.12 Service Loading 490

    15.13 Tools for Working with Modules 491

    Exercises 494

     

    Index 497