You are previewing Java 5.0 Tiger: A Developer's Notebook.
O'Reilly logo
Java 5.0 Tiger: A Developer's Notebook

Book Description

Java 5.0, code-named "Tiger", promises to be the most significant new version of Java since the introduction of the language. With over a hundred substantial changes to the core language, as well as numerous library and API additions, developers have a variety of new features, facilities, and techniques available. But with so many changes, where do you start? You could read through the lengthy, often boring language specification; you could wait for the latest 500 page tome on concepts and theory; you could even play around with the new JDK, hoping you figure things out--or you can get straight to work with Java 5.0 Tiger: A Developer's Notebook. This no-nonsense, down-and-dirty guide by bestselling Java authors Brett McLaughlin and David Flanagan skips all the boring prose and lecture, and jumps right into Tiger. You'll have a handle on the important new features of the language by the end of the first chapter, and be neck-deep in code before you hit the halfway point. Using the task-oriented format of this new series, you'll get complete practical coverage of generics, learn how boxing and unboxing affects your type conversions, understand the power of varargs, learn how to write enumerated types and annotations, master Java's new formatting methods and the for/in loop, and even get a grip on concurrency in the JVM. Light on theory and long on practical application, Java 5.0 Tiger: A Developer's Notebook allows you to cut to the chase, getting straight to work with Tiger's new features. The new Developer's Notebooks series from O'Reilly covers important new tools for software developers. Emphasizing example over explanation and practice over theory, they focus on learning by doing--you'll get the goods straight from the masters, in an informal and code-intensive style that suits developers. If you've been curious about Tiger, but haven't known where to start, this no-fluff, lab-style guide is the solution.

Table of Contents

  1. Contents
  2. The Developer’s Notebook Series
    1. Notebooks Are...
    2. Notebooks Aren’t...
    3. Organization
  3. Preface
    1. Organization
    2. How This Book Was Written
    3. About the Examples
    4. Conventions Used in This Book
    5. How to Contact Us
    6. Acknowledgments from Brett
    7. Acknowledgments from David
  4. Chapter 1. What’s New?
    1. Working with Arrays
    2. Using Queues
    3. Ordering Queues Using Comparators
    4. Overriding Return Types
    5. Taking Advantage of Better Unicode
    6. Adding String Builder to the Mix
  5. Chapter 2. Generics
    1. Using Type-Safe Lists
    2. Using Type-Safe Maps
    3. Iterating Over Parameterized Types
    4. Accepting Parameterized Types as Arguments
    5. Returning Parameterized Types
    6. Using Parameterized Types as Type Parameters
    7. Checking for Lint
    8. Generics and Type Conversions
    9. Using Type Wildcards
    10. Writing Generic Types
    11. Restricting Type Parameters
  6. Chapter 3. Enumerated Types
    1. Creating an Enum
    2. Declaring Enums Inline
    3. Iterating Over Enums
    4. Switching on Enums
    5. Maps of Enums
    6. Sets of Enums
    7. Adding Methods to an Enum
    8. Implementing Interfaces with Enums
    9. Value-Specific Class Bodies
    10. Manually Defining an Enum
    11. Extending an Enum
  7. Chapter 4. Autoboxing and Unboxing
    1. Converting Primitives to Wrapper Types
    2. Converting Wrapper Types to Primitives
    3. Incrementing and Decrementing Wrapper Types
    4. Boolean Versus boolean
    5. Conditionals and Unboxing
    6. Control Statements and Unboxing
    7. Method Overload Resolution
  8. Chapter 5. varargs
    1. Creating a Variable-Length Argument List
    2. Iterating Over Variable-Length Argument Lists
    3. Allowing Zero-Length Argument Lists
    4. Specify Object Arguments Over Primitives
    5. Avoiding Automatic Array Conversion
  9. Chapter 6. Annotations
    1. Using Standard Annotation Types
    2. Annotating an Overriding Method
    3. Annotating a Deprecated Method
    4. Suppressing Warnings
    5. Creating Custom Annotation Types
    6. Annotating Annotations
    7. Defining an Annotation Type’s Target
    8. Setting the Retention of an Annotation Type
    9. Documenting Annotation Types
    10. Setting Up Inheritance in Annotations
    11. Reflecting on Annotations
  10. Chapter 7. The for/in Statement
    1. Ditching Iterators
    2. Iterating over Arrays
    3. Iterating over Collections
    4. Avoiding Unnecessary Typecasts
    5. Making Your Classes Work with for/in
    6. Determining List Position and Variable Value
    7. Removing List Items in a for/in Loop
  11. Chapter 8. Static Imports
    1. Importing Static Members
    2. Using Wildcards in Static Imports
    3. Importing Enumerated Type Values
    4. Importing Multiple Members with the Same Name
    5. Shadowing Static Imports
  12. Chapter 9. Formatting
    1. Creating a Formatter
    2. Writing Formatted Output
    3. Using the format( ) Convenience Method
    4. Using the printf( ) Convenience Method
  13. Chapter 10. Threading
    1. Handling Uncaught Exceptions in Threads
    2. Using Thread-Safe Collections
    3. Using Blocking Queues
    4. Specifying Timeouts for Blocking
    5. Separating Thread Logic from Execution Logic
    6. Using Executor as a Service
    7. Using Callable Objects
    8. Executing Tasks Without an ExecutorService
    9. Scheduling Tasks
    10. Advanced Synchronizing
    11. Using Atomic Types
    12. Locking Versus Synchronization
  14. Index
    1. A
    2. B
    3. C
    4. D
    5. E
    6. F
    7. G
    8. H
    9. I
    10. J
    11. L
    12. M
    13. N
    14. O
    15. P
    16. Q
    17. R
    18. S
    19. T
    20. U
    21. V
    22. W
    23. X
    24. Z
  15. About the Authors
  16. Colophon
  17. Related Titles Available from O’Reilly
  18. Keep in touch with O’Reilly