Collections

 

  1. Introduction
  2. Interfaces
  3. Implementations
  4. Algorithms
  5. Custom Implementations
  6. Interoperability
  7. Common Collections Problems

 


 

What Is a Collection?

A collection (sometimes called a container) is simply an object that groups multiple elements into a single unit. Collections are used to store, retrieve and manipulate data, and to transmit data from one method to another. Collections typically represent data items that form a natural group, like a poker hand (a collection of cards), a mail folder (a collection of letters), or a telephone directory (a collection of name-to-phone-number mappings).

If you've used Java -- or just about any other programming language -- you're already familiar with collections. Collection implementations in earlier versions of Java included Vector , Hashtable(in the API reference documentation) , and array. While earlier versions of Java contained collection implementations, they did not contain a collections framework.

 

 

What Is a Collections Framework?

A collections framework is a unified architecture for representing and manipulating collections. All collections frameworks contain three things:

The best known example of collections frameworks are the C++ Standard Template Library.

 

 

What are the Benefits of a Collections Framework?

 

 

Are there any Drawbacks?

Historically, collections frameworks have been quite complex, which gave them a reputation for having a steep learning curve. We believe that Java's new collections framework breaks with this tradition, as you will learn for yourself in the following lessons.

 

 

Home