Collection in java

In this tutorial we will learn what is java.util.Collection in java.

java.util.Collection  is the root interface in the hierarchy of Java Collection framework.

The JDK does not provide any classes which directly implements this interface, but it provides classes which are implementations of more specific subinterfaces like Set and List in java.

java.util.Set extends java.util.Collection interface in java.

java.util.List extends java.util.Collection interface in java.
ArrayList, LinkedList, Vector, CopyOnWriteArrayList classes implements List interface.

Generally speaking a collection represents a group of objects, known as its elements.

Advantages of using java.util.Collection in java >
  • Performance - JDK provides many classes which implements subInterface of Collection like java.util.List and java.util.Set interface.

  • Optimised and tested - Collection implementations are optimised and well tested in java.

  • Reusability - They can be reused in java.

It’s important to note java.util.Map interface is a member of the Java Collections Framework, but it does not implement java.util.Collection interface in java.

So in this tutorial we learned what is java.util.Collection in java.

/** */

Having any doubt? or you you liked the tutorial! Please comment in below section.
Please express your love by liking (JMSE) on facebook, following on google+ or Twitter.


List >

ArrayList in java

LinkedList in java

Set >

HashSet in java

Map >

HashMap in java

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...
//start paginationJs //end paginationJs