Collection Framework in Java

Collection Framework

In java collection framework is classes and interfaces which are generally used to implement data structure.

The collection is a group of similar types of object and itself is a predefined interface present in java. util package.

All the operation which are generally performed on a data structure such as searching, sorting, insertion, deletion can be performed in java collection framework.

A collection is simply a single unit of objects.

Following are the interfaces which are directly sub-class of collection and used to implement data structure:-

  • LIST
  • SET
  • QUEUE

Collection FrameWork Advantages:-

  • It provides a redimate architecture.
  • Provides predefined class and interfaces.
  • Faster to development.
  • It is optional for a developer.
  • Less coding.
import java.util.*;  
class Collection_Framework
{  
  public static void main(String args[])
  {  
   ArrayList<String> list=new ArrayList<String>();//Creating arraylist  
   list.add("Ravi");//Adding object in arraylist  
   list.add("Dezy");  
   list.add("Satya");  
   list.add("Rashmi");  
   Iterator itor=list.iterator();  
    while(itor.hasNext())
    {  
     System.out.println(itor.next());  
    }  
  }  
}  




basicittopic

basicittopic

A Computer Science Study for IT students and people of IT community

Leave a Reply

shares