November 26, 2015

Collection Framework in java

Java has a very huge variety of feature one of which is Collection interfaces.

Java has a rich Collection interfaces and Classes to use for the developer community. And now a days these collections are very much helpful to the developers for the storing multiple data.

Collection is something like the array but it is too different from the array. Main difference is array stores only one type of data in whole array, like if array is type of integer we can store only numeric values in it where as in a particular collection object we can store any type of data at a time.

Collection enables us to work with the group of objects.

Collection framework have main 3 types of interface

  1. List
  2. Set
  3. Map


Core interfaces of Collection Framework

From the above image we can see that root of Set and List interface is Collection interface. A Map is separate interface but it is to be in the collection framework.

There are some of the common method which is in Collection interface which we can use in all the sub interfaces of the collections. Methods are listed below:

  1. add()
  2. addAll()
  3. clear()
  4. iterator()
  5. remove()
  6. removeAll()
  7. size()

No comments:

Post a Comment