Collection in java

You are here : Home / Core Java Tutorials / Collection framework Tutorial in java

Contents of page>

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

1. What is java.util.Collection?
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.

2. Set and List extends Collection
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.

3. Features of Collection in java >

4. Advantages of using Collection in java >
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

Must read for you :