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