Freelancercafe

Friday, May 18th

Last update05:06:15 AM GMT

You are here: Web & Programming Java Frameworks Java Collection Framework

Java Collection Framework

E-mail Print

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 Java 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 Java 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 Java 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