Collection Framework

  • Collection Object
  •         If any object is collection of hetrogeneous objects or elements is known as collection object.
  • Collection Class
  •         Every collection object can be derived from a special class called collection class.
  • Collection Framework
  •         collection of collection classes is known as collection framework.
  • In java language all collection classes are existing as predefined package in java.util package.
  • The main aim of collection framework is to manage the data very efficiently in the memory( managing data represents searching the data, sorting data etc..)
  • Note:In java language data structure (managing the data in the memory) can be achieved by collection framework.
    In java language collection framework mainly depends on following interfaces.
    1. List Interface
    2. Set Interface
    3. Map Interface

  • List Interface:
  • it is a predefined interface in java.util package. It accepts duplicate data in the memory. which was implemented following collection classes.
    1. Array List
    2. Vector
    3. Stack
    4. Linked List etc...
    objects of above collection calsses accepts hetrogeneous data.
  • Set Interface:
  • it is a predefined interface in java.util package. It accepts unique data in the memory. which was implemented following collection classes.
    1. HashSet
    2. LinkedHshSet
  • Map Interface:
  • it is a predefined interface in java.util package. It accepts elements in the form of key value pair(key allows unique elements where as value allows duplicate elements). which was implemented following collection classes.
    1. HashMap
    2. HashTable
    All the collection classes are existing as templete of generic classes.In java.util package to allocate sufficient memory space we must create an object for any collection class with the following syntax
        collectionclass<wrapperclass> objref=new collectionclass<wrapperclass>();
          
    In the above syntax based on wrapper class is allocates sufficient memory for that related element.
    example:
    Stack<Integer> objref=new Stack<Integer>();
    In the above example stack can be accept only integer elsements.
    Stack<String> objref=new Stack<String>();
    In the above example stack can be accept only String elsements.

    Templete or Generic:

    it is a common structure for an element or object, If any class is common to multiple object known as tmplete class or generic class.

    MAP Interface Implemented classes

    1. Hashmap Methods Click Here
    2. HashTable Methods Click Here