Java Generics and Collections

Book description

None

Table of contents

  1. Dedication
  2. A Note Regarding Supplemental Files
  3. Preface
    1. Obtaining the Example Programs
    2. How to Contact Us
    3. Conventions Used in This Book
    4. Using Code Examples
    5. Safari® Books Online
    6. Acknowledgments
  4. I. Generics
    1. 1. Introduction
      1. Generics
      2. Boxing and Unboxing
      3. Foreach
      4. Generic Methods and Varargs
      5. Assertions
    2. 2. Subtyping and Wildcards
      1. Subtyping and the Substitution Principle
      2. Wildcards with extends
      3. Wildcards with super
      4. The Get and Put Principle
      5. Arrays
      6. Wildcards Versus Type Parameters
      7. Wildcard Capture
      8. Restrictions on Wildcards
    3. 3. Comparison and Bounds
      1. Comparable
      2. Maximum of a Collection
      3. A Fruity Example
      4. Comparator
      5. Enumerated Types
      6. Multiple Bounds
      7. Bridges
      8. Covariant Overriding
    4. 4. Declarations
      1. Constructors
      2. Static Members
      3. Nested Classes
      4. How Erasure Works
    5. 5. Evolution, Not Revolution
      1. Legacy Library with Legacy Client
      2. Generic Library with Generic Client
      3. Generic Library with Legacy Client
      4. Legacy Library with Generic Client
        1. Evolving a Library using Minimal Changes
        2. Evolving a Library using Stubs
        3. Evolving a Library using Wrappers
      5. Conclusions
    6. 6. Reification
      1. Reifiable Types
      2. Instance Tests and Casts
      3. Exception Handling
      4. Array Creation
      5. The Principle of Truth in Advertising
      6. The Principle of Indecent Exposure
      7. How to Define ArrayList
      8. Array Creation and Varargs
      9. Arrays as a Deprecated Type?
      10. Summing Up
    7. 7. Reflection
      1. Generics for Reflection
      2. Reflected Types are Reifiable Types
      3. Reflection for Primitive Types
      4. A Generic Reflection Library
      5. Reflection for Generics
      6. Reflecting Generic Types
    8. 8. Effective Generics
      1. Take Care when Calling Legacy Code
      2. Use Checked Collections to Enforce Security
      3. Specialize to Create Reifiable Types
      4. Maintain Binary Compatibility
    9. 9. Design Patterns
      1. Visitor
      2. Interpreter
      3. Function
      4. Strategy
      5. Subject-Observer
  5. II. Collections
    1. 10. The Main Interfaces of the Java Collections Framework
    2. 11. Preliminaries
      1. Iterable and Iterators
      2. Implementations
      3. Efficiency and the O-Notation
      4. Contracts
      5. Collections and Thread Safety
        1. Synchronization and the Legacy Collections
        2. JDK 1.2: Synchronized Collections and Fail-Fast Iterators
        3. Concurrent Collections: Java 5 and Beyond
    3. 12. The Collection Interface
      1. Using the Methods of Collection
      2. Implementing Collection
      3. Collection Constructors
    4. 13. Sets
      1. Implementing Set
        1. HashSet
        2. LinkedHashSet
        3. CopyOnWriteArraySet
        4. EnumSet
      2. SortedSet and NavigableSet
        1. NavigableSet
        2. TreeSet
        3. ConcurrentSkipListSet
      3. Comparing Set Implementations
    5. 14. Queues
      1. Using the Methods of Queue
      2. Implementing Queue
        1. PriorityQueue
        2. ConcurrentLinkedQueue
      3. BlockingQueue
        1. Using the Methods of BlockingQueue
        2. Implementing BlockingQueue
          1. LinkedBlockingQueue
          2. ArrayBlockingQueue
          3. PriorityBlockingQueue
          4. DelayQueue
          5. SynchronousQueue
      4. Deque
        1. Implementing Deque
          1. ArrayDeque
          2. LinkedList
        2. BlockingDeque
          1. Implementing BlockingDeque
      5. Comparing Queue Implementations
    6. 15. Lists
      1. Using the Methods of List
      2. Implementing List
        1. ArrayList
        2. LinkedList
        3. CopyOnWriteArrayList
      3. Comparing List Implementations
    7. 16. Maps
      1. Using the Methods of Map
      2. Implementing Map
        1. HashMap
        2. LinkedHashMap
        3. WeakHashMap
        4. IdentityHashMap
        5. EnumMap
      3. SortedMap and NavigableMap
        1. NavigableMap
        2. TreeMap
      4. ConcurrentMap
        1. ConcurrentHashMap
      5. ConcurrentNavigableMap
        1. ConcurrentSkipListMap
      6. Comparing Map Implementations
    8. 17. The Collections Class
      1. Generic Algorithms
        1. Changing the Order of List Elements
        2. Changing the Contents of a List
        3. Finding Extreme Values in a Collection
        4. Finding Specific Values in a List
      2. Collection Factories
      3. Wrappers
        1. Synchronized Collections
        2. Unmodifiable Collections
        3. Checked Collections
      4. Other Methods
  6. Index
  7. About the Authors
  8. Colophon
  9. Copyright

Product information

  • Title: Java Generics and Collections
  • Author(s):
  • Release date:
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: None