Core java tutorial for beginners
A tutorial blog which explains different core concepts related to Java along with programming examples

February 19, 2018 Categories: Java Collections. 1 Comment on Introduction to Java Collections Framework

What is Java Collections Framework?

 

In order to write efficient programs you need to know how to work with a data structure. A data structure is a entity which contains a group of data organized in some manner. Examples of popular data structures are arrays, stacks, queues, linked lists, trees, etc.

 

Java provides many data structures. The data structure framework or library provided by Java is known as the Java Collections Framework (JCF). Java defines a collection as an object that represents a group of objects.

 

The collections framework is a standard way for representing and manipulating collections. It contains the following components:

 

  • Interfaces: These are abstract data types that represent collections. Interfaces allow collections to be manipulated independently of the details of their representation. In object-oriented languages, interfaces generally form a hierarchy.

 

  • Classes: These are the concrete implementations of the collection interfaces. In essence, they are reusable data structures.

 

  • Algorithms: These are the methods that perform useful computations, such as searching and sorting, on objects that implement collection interfaces. The algorithms are said to be polymorphic: that is, the same method can be used on many different implementations of the appropriate collection interface. In essence, algorithms are reusable functionality.

 

What Can I Do with a Collection?

 

  • Add objects to the collection.
  • Remove objects from the collection.
  • Find out if an object (or group of objects) is in the collection.
  • Retrieve an object from the collection (without removing it).
  • Iterate through the collection, looking at each element (object) one after another.

 

Goals of Java Collections Framework

 

The collections framework was designed to meet the following goals:

 

  • The framework had to be high-performance. The implementations for the fundamental collections (dynamic arrays, linked lists, trees, and hash tables) are highly efficient.
  • The framework had to allow different types of collections to work in a similar manner and with a high degree of interoperability.
  • Extending and/or adapting a collection had to be easy.

 

Interfaces in Java Collections Framework

 

Following is the Java Collections Framework hierarchy:

 

java collections framework hierarchy

 

Following are various interfaces available in Java Collections Framework:

 

Java Collection Interfaces

 

Classes in Java Collections Framework

 

Following are various classes available in Java Collections Framework:

 

java collection classes

 

 

Related Links:

Note: Do you have a question on this article or have a suggestion to make this article better? You can ask or suggest us by filling in the below form. After commenting, your comment will be held for moderation and will be published in 24-48 hrs.

1 Comment

You can follow any responses to this entry through the RSS 2.0 feed.

Java Collection framework is a very popular framework of Java which provides a strong architecture to store or easily control the group of objects. For the purpose of better understanding.

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll Up