What is collections framework ?

The java collections framework standardizes the way in which a group of objects are handled by your program. It was added in java1.2 release. But in jdk1.5 there are many changes to collection like, addition of generics, auto boxing/unboxing, and the for-each style for loop.
It defines set of classes and interfaces which can be used for representing a group of objects as single entity.
Declaration of Collection interface:
Interface Collection
Here ‘E’ specifies the type of element collection can hold.
Advantages of Collection :
-A programmer can effectively reduce the effort of programming by the help of effective algorithms and data structures provided by the framework.
-It increases program speed and quality since the implementation of each interface is interchangeable.
-It reduces the effort in designing new API.
-It encourages software reuse since the interfaces and algorithm are reuseable.
-By the help help of api programmer can achieve different operation on Collection
-The generic constructor provide type safety.

what we can do with Collection ?
■ Add objects to the collection.
■ Remove objects from the collection.
■ Find out if an object (or group of objects) is in the collection.
■ Retrieve an object from the collection (without removing it).
■ Iterate through the collection, looking at each element (object) one
after another.

Collections come in four basic flavors:

■ Lists Lists of things (classes that implement List)(ordered).
■ Sets Unique things (classes that implement Set).
■ Maps Things with a unique ID (classes that implement Map).
■ Queues Things arranged by the order in which they are to be processed.

1 comment:

  1. Now this is the kinda of stuff i like to read about thanks for brightening my day

    Jin
    www.imarksweb.org

    ReplyDelete