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.

Publisher resources

View/Submit Errata

Table of contents

  1. A Note Regarding Supplemental Files
  2. Copyright
  3. The Developer’s Notebook Series
    1. Notebooks Are...
    2. Notebooks Aren’t...
    3. Organization
  4. 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
  5. 1. What’s New?
    1. 1.1. Working with Arrays
      1. 1.1.1. How do I do that?
      2. 1.1.2. What About...
    2. 1.2. Using Queues
      1. 1.2.1. How do I do that?
      2. 1.2.2. What about...
    3. 1.3. Ordering Queues Using Comparators
      1. 1.3.1. How do I do that?
    4. 1.4. Overriding Return Types
      1. 1.4.1. How do I do that?
    5. 1.5. Taking Advantage of Better Unicode
      1. 1.5.1. How do I do that?
      2. 1.5.2. What just happened?
    6. 1.6. Adding StringBuilder to the Mix
      1. 1.6.1. How do I do that?
      2. 1.6.2. What about...
  6. 2. Generics
    1. 2.1. Using Type-Safe Lists
      1. 2.1.1. How do I do that?
      2. 2.1.2. What just happened?
      3. 2.1.3. What about...
    2. 2.2. Using Type-Safe Maps
      1. 2.2.1. How do I do that?
      2. 2.2.2. What just happened?
    3. 2.3. Iterating Over Parameterized Types
      1. 2.3.1. How do I do that?
      2. 2.3.2. What about...
    4. 2.4. Accepting Parameterized Types as Arguments
      1. 2.4.1. How do I do that?
      2. 2.4.2. What about...
    5. 2.5. Returning Parameterized Types
      1. 2.5.1. How do I do that?
    6. 2.6. Using Parameterized Types as Type Parameters
      1. 2.6.1. How do I do that?
    7. 2.7. Checking for Lint
      1. 2.7.1. How do I do that?
      2. 2.7.2. What about...
    8. 2.8. Generics and Type Conversions
      1. 2.8.1. How do I do that?
      2. 2.8.2. What just happened?
      3. 2.8.3. What about...
    9. 2.9. Using Type Wildcards
      1. 2.9.1. How do I do that?
      2. 2.9.2. What about...
    10. 2.10. Writing Generic Types
      1. 2.10.1. How do I do that?
      2. 2.10.2. What about...
    11. 2.11. Restricting Type Parameters
      1. 2.11.1. How do I do that?
      2. 2.11.2. What about...
  7. 3. Enumerated Types
    1. 3.1. Creating an Enum
      1. 3.1.1. How do I do that?
      2. 3.1.2. What just happened?
      3. 3.1.3. What about...
    2. 3.2. Declaring Enums Inline
      1. 3.2.1. How do I do that?
    3. 3.3. Iterating Over Enums
      1. 3.3.1. How do I do that?
      2. 3.3.2. What just happened?
      3. 3.3.3. What about...
    4. 3.4. Switching on Enums
      1. 3.4.1. How do I do that?
      2. 3.4.2. What just happened?
      3. 3.4.3. What about...
    5. 3.5. Maps of Enums
      1. 3.5.1. How do I do that?
    6. 3.6. Sets of Enums
      1. 3.6.1. How do I do that?
    7. 3.7. Adding Methods to an Enum
      1. 3.7.1. How do I do that?
      2. 3.7.2. What about...
    8. 3.8. Implementing Interfaces with Enums
      1. 3.8.1. How do I do that?
    9. 3.9. Value-Specific Class Bodies
      1. 3.9.1. How do I do that?
      2. 3.9.2. What just happened?
      3. 3.9.3. What about...
    10. 3.10. Manually Defining an Enum
      1. 3.10.1. How do I do that?
    11. 3.11. Extending an Enum
      1. 3.11.1. How do I do that?
      2. 3.11.2. What about...
  8. 4. Autoboxing and Unboxing
    1. 4.1. Converting Primitives to Wrapper Types
      1. 4.1.1. How do I do that?
      2. 4.1.2. What just happened?
    2. 4.2. Converting Wrapper Types to Primitives
      1. 4.2.1. How do I do that?
      2. 4.2.2. What about...
    3. 4.3. Incrementing and Decrementing Wrapper Types
      1. 4.3.1. How do I do that?
      2. 4.3.2. What just happened?
    4. 4.4. Boolean Versus boolean
      1. 4.4.1. How do I do that?
      2. 4.4.2. What about...
    5. 4.5. Conditionals and Unboxing
      1. 4.5.1. How do I do that?
      2. 4.5.2. What just happened?
    6. 4.6. Control Statements and Unboxing
      1. 4.6.1. How do I do that?
    7. 4.7. Method Overload Resolution
      1. 4.7.1. How do I do that?
      2. 4.7.2. What just happened?
  9. 5. varargs
    1. 5.1. Creating a Variable-Length Argument List
      1. 5.1.1. How do I do that?
      2. 5.1.2. What just happened?
      3. 5.1.3. What about...
    2. 5.2. Iterating Over Variable-Length Argument Lists
      1. 5.2.1. How do I do that?
      2. 5.2.2. What about...
    3. 5.3. Allowing Zero-Length Argument Lists
      1. 5.3.1. How do I do that?
      2. 5.3.2. What about...
    4. 5.4. Specify Object Arguments Over Primitives
      1. 5.4.1. How do I do that?
    5. 5.5. Avoiding Automatic Array Conversion
      1. 5.5.1. How do I do that?
  10. 6. Annotations
    1. 6.1. Using Standard Annotation Types
      1. 6.1.1. How do I do that?
      2. 6.1.2. What just happened?
      3. 6.1.3. What about...
    2. 6.2. Annotating an Overriding Method
      1. 6.2.1. How do I do that?
      2. 6.2.2. What about...
    3. 6.3. Annotating a Deprecated Method
      1. 6.3.1. How do I do that?
      2. 6.3.2. What about...
    4. 6.4. Suppressing Warnings
      1. 6.4.1. How do I do that?
    5. 6.5. Creating Custom Annotation Types
      1. 6.5.1. How do I do that?
      2. 6.5.2. What about...
    6. 6.6. Annotating Annotations
      1. 6.6.1. How do I do that?
    7. 6.7. Defining an Annotation Type’s Target
      1. 6.7.1. How do I do that?
      2. 6.7.2. What about...
    8. 6.8. Setting the Retention of an Annotation Type
      1. 6.8.1. How do I do that?
    9. 6.9. Documenting Annotation Types
      1. 6.9.1. How do I do that?
    10. 6.10. Setting Up Inheritance in Annotations
      1. 6.10.1. How do I do that?
      2. 6.10.2. What about...
    11. 6.11. Reflecting on Annotations
      1. 6.11.1. How do I do that?
      2. 6.11.2. What just happened?
      3. 6.11.3. What about...
  11. 7. The for/in Statement
    1. 7.1. Ditching Iterators
      1. 7.1.1. How do I do that?
      2. 7.1.2. What just happened?
      3. 7.1.3. What about...
    2. 7.2. Iterating over Arrays
      1. 7.2.1. How do I do that?
      2. 7.2.2. What about...
    3. 7.3. Iterating over Collections
      1. 7.3.1. How do I do that?
    4. 7.4. Avoiding Unnecessary Typecasts
      1. 7.4.1. How do I do that?
      2. 7.4.2. What just happened?
    5. 7.5. Making Your Classes Work with for/in
      1. 7.5.1. How do I do that?
        1. 7.5.1.1. Extending collection classes
        2. 7.5.1.2. Handling iteration manually
    6. 7.6. Determining List Position and Variable Value
      1. 7.6.1. How do I do that?
    7. 7.7. Removing List Items in a for/in Loop
      1. 7.7.1. How do I do that?
      2. 7.7.2. What about...
  12. 8. Static Imports
    1. 8.1. Importing Static Members
      1. 8.1.1. How do I do that?
      2. 8.1.2. What about...
    2. 8.2. Using Wildcards in Static Imports
      1. 8.2.1. How do I do that?
      2. 8.2.2. What about...
    3. 8.3. Importing Enumerated Type Values
      1. 8.3.1. How do I do that?
    4. 8.4. Importing Multiple Members with the Same Name
      1. 8.4.1. How do I do that?
      2. 8.4.2. What about...
    5. 8.5. Shadowing Static Imports
      1. 8.5.1. How do I do that?
  13. 9. Formatting
    1. 9.1. Creating a Formatter
      1. 9.1.1. How do I do that?
    2. 9.2. Writing Formatted Output
      1. 9.2.1. How do I do that?
        1. 9.2.1.1. Types
        2. 9.2.1.2. Precision
        3. 9.2.1.3. Width
        4. 9.2.1.4. Argument
        5. 9.2.1.5. Flags
        6. 9.2.1.6. Output
    3. 9.3. Using the format( ) Convenience Method
      1. 9.3.1. How do I do that?
    4. 9.4. Using the printf( ) Convenience Method
      1. 9.4.1. How do I do that?
  14. 10. Threading
    1. 10.1. Handling Uncaught Exceptions in Threads
      1. 10.1.1. How do I do that?
      2. 10.1.2. What about...
    2. 10.2. Using Thread-Safe Collections
      1. 10.2.1. How do I do that?
        1. 10.2.1.1. ConcurrentHashMap
        2. 10.2.1.2. CopyOnWriteArrayList
        3. 10.2.1.3. CopyOnWriteArraySet
      2. 10.2.2. What just happened?
      3. 10.2.3. What about...
    3. 10.3. Using Blocking Queues
      1. 10.3.1. How do I do that?
    4. 10.4. Specifying Timeouts for Blocking
      1. 10.4.1. How do I do that?
      2. 10.4.2. What about...
    5. 10.5. Separating Thread Logic from Execution Logic
      1. 10.5.1. How do I do that?
      2. 10.5.2. How do I do that?
      3. 10.5.3. What about...
    6. 10.6. Using Executor as a Service
      1. 10.6.1. How do I do that?
    7. 10.7. Using Callable Objects
      1. 10.7.1. How do I do that?
    8. 10.8. Executing Tasks Without an ExecutorService
      1. 10.8.1. How do I do that?
      2. 10.8.2. What about...
    9. 10.9. Scheduling Tasks
      1. 10.9.1. How do I do that?
      2. 10.9.2. What about...
    10. 10.10. Advanced Synchronizing
      1. 10.10.1. How do I do that?
    11. 10.11. Using Atomic Types
      1. 10.11.1. How do I do that?
      2. 10.11.2. What about...
    12. 10.12. Locking Versus Synchronization
      1. 10.12.1. How do I do that?
      2. 10.12.2. What about...
  15. Index
  16. About the Authors
  17. Colophon
  18. Copyright

Product information

  • Title: Java 5.0 Tiger: A Developer's Notebook
  • Author(s): Brett McLaughlin, David Flanagan
  • Release date: June 2004
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9780596007386