Collections and Java Collections Frame work

Introduction

In this lesson , we are going to discuss abot the most important topic of any programming language .That is data structures.Without data structure it becomes a nightmare for a programmer to handle the data elements which are to be collected as a group or bunch of things.These elements may or may not  have any relation among them.These data structures are defined and modified in java as collections  which we are studying in this lesson.

What are Collections

A Collection is bunch of elements or objects which can be formed a group entity.These elements structure is common for all elements for a particular group.In real world we can see a group of employees where as we can put them into a collection of employee objects.Now, you can have a doubt "when arrays can fulfill this , but why only collections?" . we will discuss the disadvantages below.

Disadvantages of arrays over collections

  • An array which is non-empty is always mutable, Collections can be mutable or immutable.
  • An array is not thread safe, But collections are.
  • Main advantage in collections is they are type-safe,but arrays are not.
  • Collections can have filters , where as arrays doesn't.
  • Arrays permits null element forever, Collections can restrict this if needed.
  • Dynamic expansion is possible for collections.

Java Collection Frame work

Java provides a standard Collection API , which included standard interfaces , classes and implementations, algorithms.This API provides flexibility for a developer to organize data in a structured way into memory.We will go further step by step reading with components of Java Collections API.
In Java collections framework is provided under java.util package.Java collection API provides basic interfaces depending upon their usage and retrieving of data as follows:

Core Interfaces of Java Collections Framework

Core collection interfaces are the base foundation for Java collection frame work.The Core collection interfaces are as give below.

Core Collection Interfaces hierarchy

The picture shown below explains the hierarchy of the Java Core Collection Interfaces.

We will further explore more about these interfaces in upcoming lessons.

Next 



A symmetry boggles over a snag.

0 comments:

Post a Comment