Part II: Collections


The Java Collections Framework is a set of interfaces and classes in the packages java.util and java.util.concurrent. They provide client programs with various models of how to organize their objects, and various implementations of each model. These models are sometimes called abstract data types, and we need them because different programs need different ways of organizing their objects. In one situation, you might want to organize your program's objects in a sequential list because their ordering is important and there are duplicates. In another, a set might be the right data type because now ordering is unimportant and you want to discard the duplicates. These two data types (and others) are represented by different interfaces in the Collections Framework, and we will look at examples of their use in this chapter. But that's not all; none of these data types has a single "best" implementationthat is, one implementation that is better than all the others for all the operations. For example, a linked list may be better than an array implementation of lists for inserting and removing elements from the middle, but much worse for random access. So choosing the right implementation for your program involves knowing how it will be used as well as what is available.

This part of the book starts with an overview of the Framework and then looks in detail at each of the main interfaces and the standard implementations of them. Finally we will look at the special-purpose implementation and generic algorithms provided in the Collections class.

Chapter 10, The Main Interfaces of the Java Collections Framework

Chapter 11, Preliminaries

Chapter 12, The Collection Interface

Chapter 13, Sets

Chapter 14, Queues

Chapter 15, Lists

Chapter 16, Maps

Chapter 17, The Collections Class





Java Generics and Collections
Java Generics and Collections
ISBN: 0596527756
EAN: 2147483647
Year: 2006
Pages: 136

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net