Java Collection Framework

We have tried you to make a walk through the Collection Framework. The Collection Framework provides a well-designed set if interface and classes for sorting and manipulating groups of data as a single unit, a collection.

The Collection Framework provides a standard programming interface to many of the most common abstractions, without burdening the programmer with too many procedures and interfaces.

The Collection Framework is made up of a set of interfaces for working with the groups of objects. The different interfaces describe the different types of groups. For the most part, once you understand the interfaces, you understand the framework. While you always need to create specific, implementations of the interfaces, access to the actual collection should be restricted to the use of the interface methods, thus allowing you to change the underlying data structure, without altering the rest of your code.

In the Collections Framework, the interfaces Map and Collection are distinct with no lineage in the hierarchy. The typical application of map is to provide access to values stored by keys.

When designing software with the Collection Framework, it is useful to remember the following hierarchical relationship of the four basic interfaces of the framework.

  • The Collection interface is a group of objects, with duplicates allowed.
  • Set extends Collection but forbids duplicates.
  • List extends Collection also, allows duplicates and introduces positional indexing.
  • Map extends neither Set nor Collection

Interface
Implementation
Historical
Set
HashSet
TreeSet
List
ArrayList
LinkedList
Vector
Stack
Map
HashMap
Treemap
Hashtable
Properties

The historical collection classes are called such because they have been around since 1.0 release of the java class libraries. If you are moving from historical collection to the new framework classes, one of the primary differences is that all operations are synchronized with the new classes. While you can add synchronization to the new classes, you cannot remove from the old.

Explore the Interface and Classes of Java Collection Framework


Collection Interface
Iterator Interface
Set Interface
List Interface
ListIterator Interface
Map Interface
SortedSet Interface
SortedMap Interface
HashSet & TreeSet Classes
ArrayList & LinkedList Classes
HashMap & Treemap Classes
Vector and Stack Classes

 
 

Collection Framework
Collection Interface
Iterator Interface
Set Interface
List Interface
ListIterator Interface
Map Interface
SortedSet Interface
SortedMap Interface
HashSet & TreeSet Classes
ArrayList & LinkedList Classes

HashMap & Treemap Classes
Vector & Stack Classes

Use of this website constitutes acceptance of the AllAppLabs.com Terms and Conditions