Collections in Java Part I : Introduction.

Hello Friends,

This is one of my tutorials regarding one of the best feature in java i.e. Collections Framework. First of all, we need to understand the basic characteristics regarding this.

Why Collections?

In the versions prior to 1.2 the standard methods for grouping Java objects were via the Array, the Vector, and the HashTable classes, which were not easy to extend, and did not implement a standard member interface.

Collections:  Introduction.

A collection, in general, means something like a group of objects stored in a structured manner, it is also called as a container. The Java collections framework is a set of classes and interfaces that implements commonly reusable collection data structures. It represents a group of objects, known as its elements. Basically it is a package of commonly used data structures that includes Lists, Sets and Maps.

However the interfaces Map and Collection are distinct, they are the two top-level interfaces. They both are at the same level in hierarchy, it can be viewed as:-

The reason for this distinction has to do with the ways that Set and Map are used in Java. Sets cannot contain duplicates and provide random access to their elements; Maps connect unique keys with values, provide random access to its keys and may host duplicate values.

The Collections Framework provides a well-designed set of interfaces and classes for storing and manipulating groups of data as a single unit, a collection.

While using this Framework remember the following hierarchical relationships of the four basic interfaces of the collections-

  • The Collection interface is a group of objects, which also allows duplicates.
  • Set extends Collection but does not allow duplicates.
  • List extends Collection, allows duplicates and introduces positional indexing.
  • Map neither extends Set nor Collection.

The three collection interfaces can be implemented in six ways, each twice, as follows

Advantage of the Collections Framework:

The collections framework offers following advantages for the java developers:

  • Increases the readability of collections by providing a standard set of interfaces which has to be used by developers in different applications.
  • It makes the code more flexible
  • It offers many specific implementations of the interfaces.
  • It allows you to choose the collection that is most fitting and which offers the highest performance for your purposes.

These collections framework are very easy to implement. These interfaces can be transparently substituted to increase the application performance.

Hope this will help you.

Thanks,

admin@code2java.com

Related Posts

  • Abstract Class In JAVA

    Hello Friends, This tutorial is for all the Java followers. One of the best feature that is widely used is the term ‘Abstract’. This term can be used as either class or a simple method. An abstract method is any method that is just declared but not instantiated. In other words one can just create…

  • Threads in Java.

    Hello Friends, This is the tutorial for the java developers. One of the most significance feature of core java is Threading. Threading deals with the processing of Threads in a single java program. Let us learn what actually are Threads. *What are Threads? Threads are independently running processes that are isolated from each other upto…

  • Collections In Java.

    Hello friends, Welcome to another tutorial for java followers. You all may have heard about Collections, it is one of the amazing feature in java. Collections are the object for the group of elements, these elements are nothing but the different data structures like as Array Lists, Linked Lists, Vectors, Hash tables,Hash List, Trees, Hash…

  • Maven Installation.

    Hello Friends, This is one of my tutorial for installation of Maven on windows. Maven is a software project management tool. Based on the concept of a project object model (POM), Maven can manage a project’s build, reporting and documentation from a central piece of information. Maven is an open source community and is a…

  • Jira Plugin Deployment.

    Hello Friends, This is one of the most important tutorial for all the jira developers. You may have heard about the plugins in jira which is a simple Java Archive File with .jar extension. This JAR file contains the class files and auxiliary resources associated with the applications. In Jira we can use Eclipse IDE…

One Comment

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.