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 maps etc. Collections are used to store, retrieve, update, delete and communicate the aggregate data i.e. data composed of a multitude or combination of other individual data. Collection represents the data items from a particular group and hence they are also called as “Container”. It consists of both ordered and unordered elements. Collection mainly contains the data items from a natural group, for eg. collection of cards and message box that contains different messages

* Advantages of Collections:-


1)  There is no limitation on the growth of a container, i.e. collection can grow as necessary.

2) It only contains the objects i.e only reference type.

3) Collections can be made Thread Safe i.e. concurrent access can be provided.

4) We can restrict the modification in the available collection.

The earlier versions of JDK does not include Collection Frameworks but the version 1.2 and later has Collection Framework in its java.util package. The collection Framework is the unified architecture of representing and manipulating collections. This manipulation of collections is done independently, this boosts up the performance and accuracy. A framework  mainly consists of the following essential components-

1) Interfaces:- These are the abstract data types used for the representation of the collections. It describes the core collection interfaces.  With the help of interfaces, collections are manipulated independently. With interfaces, Collection can form the hierarchy.

2) Implementations:– This describes the JDK’s general purpose collection implementation and when to use which implementation. They are the reusable data structures with the implementation of the collection interfaces.

3) Algorithms:- Algorithms are used to perform computations, such as searching, sorting etc on the objects that implement collection interfaces. They provide polymorphism i.e. the same method can be used with different implementations of the collection interfaces. It guides the implementation to the correct path that can save computation time with maximum throughput.

4) Utilities: Utility functions such as arrays of primitives and reference objects. This functionality was added to the Java platform as a part of the Collections Framework.


*Advantages of Collection Framework:-


1) Reduces programming effort: CF reduces programming effort providing useful data structures and algorithms and frees you to concentrate on the important parts of your program such as its performance and maintainance rather than on other parts. By facilitating interoperability among unrelated APIs, the Java Collections Framework frees you from writing adapter objects or conversion code to connect APIs.

2) Increases program speed and quality: This Framework provides high-performance, high-quality implementations of your own data structures and algorithms. Also the various implementations of each interface are interchangeable, so programs can be easily tuned by switching collection implementations. It offers many specific implementations of the interfaces, allowing you to choose the collection that is most fitting and offers the highest performance for your needs.

3) Reduces effort to learn and to use new APIs: Many APIs naturally take collections on input and furnish them as output.But with the advent of standard collection interfaces, it is easy to learn and use new APIs. It dramatically increases the readability of your collections by providing a standard set of interfaces to be used by many programmers in many applications.

4) Reduces effort to design new APIs: Developers don’t have to design a brand new code each time they create an API that relies on collections instead, they can use standard collection interfaces.

5) Code Flexibility: It makes your code more flexible by allowing you to pass and return interfaces instead of concrete classes, generalizing your code rather than locking it down.

Hope this will help you.

Thanks,

Nikhil.

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…

  • 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…

  • Java Date Format.

    Hello Friends, This is one of my tutorials regarding java Date format / object in Java. Many of us find it difficult to store the current date from the java application in database. Lets consider MySql as a database in this case. Now when we create a row in the database table that stores date…

2 Comments

  1. Hi, I want to let all of you bloggers / web users find out about a new Search Engine called Braxea. Its pretty dam cool… It combines Google, Bing and Yahoo into one and even lets you search for videos on YouTube and News throughout the net. Maybe this may become the new Google ?

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.