The Architecture of Java Collection Framework

According to Wikipedia the Java Collection Framework ( JCF ) is a set of classes and interfaces that implement commonly reusable data structure. Although refereed to as a framework, it works in a manner of a library.

In my opinion, Collection Framework is a collection of some most used data structure like List, Set, Map. Data structure is everything we know. If we want to make a good program or algorithm we must focus on data structure. Because in programming we just work with data. We create, manipulate, retrieve,  delete, search, sort on various type of data. So we need a better organized data. And collection frame help us to choose a better data structure without implement it ourselves. There are lot of data structure which is already implemented in efficient way. We just have to create an object of that and use it. They also provide lots of methods to work with these data structure. This post is all about collection framework and it’s architecture.

 

Collection_ListImplementation

 

A collection framework is unified architecture for representing and manipulating collections. All collection framework contains the following-

  •  Interfaces: These are abstract data types that represents 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.

Collection Interfaces:

The Collection interfaces are divided into two groups. The most common collections has the following descendants —

The Other collections are based on map.

If we divide the whole collection we have actually four part –

  1. List: The very basic interface of collection framework is List which extends Collections and it has many direct children. Like – AbstractList, ArrayList, LinkedList, Stack, Vector, RoleList etc. To checkout please visit List API
  2. Set: Another important interface is Set. It has also some direct children. Like – AbstractSet, EnumSet, HashSet, LinkedHashSet, TreeSet.  For full info please visit Set API
  3. Map: Map has many direct children. Like – AbstractMap, ConcurrentHashMap, ConcurrentSkipListMap, EnumMap, HashMap, HashTable, IdentityHashMap, LinkedHashMap, TreeMap etc. Please check it here Map API
  4. Iterator: It’s an awesome tools to traverse throw the collections. Please check it here Iterator

Except this four major part there are lot of interface available. And also there are lot of classes which implement this interfaces. But most commonly used collections are placed here. This article is all about the architecture of collection framework. I will write several post on each and every interface and classes of Collection Framework. All I write is my thinking. If any topics I describe seems wrong please feel free to inform me.

Thanks

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s