Monday, 26 August 2013

JAVA : Collections

                    Collections And Framework


                                   Collections
A Collection is a group of objects .The collection framework  defines  several interfaces  of  which the collection  interfaces of which the collection  interfaces is the foundation  upon  which the collection  framework is built .The collection interface declares the  core method  that a collection will have.
collection  provides java developers a set of classes and interfaces  that makes  it easier to handle   a collection of objects,in this way it works a bit like array but their size can be change dynamically  and it has more advanced behavior than array.

                                    Framework


Framework are repeatable ways of  solving problem. Framework  are a prescriptive set of buildings blocks and services .The developers  can use  to achieve  some goal.Basically , a frame work  provides  the infrastructure  to solve a type  of  a problem .A Framework  is  not the solution to a problem ,it is simply the tool with which  we struct  a  solution .

                             Collection Interfaces

Collection:-
Enables you to work  with  group  of  object ,it is  at  the top  of the collections hierarchy.

List:-
Extends collection to handle sequences  (list of objects ).

Set:-
Extends  collection to handle  sets ,which must  contain unique elements .

Sorted set:-
Extends set to handle sorted set.


                    Collection  Interface Methods

 

Boolean Add All (collection c):-
Adds  all the elements  of c to  the  invoking collection  return  true if the operation  succeeded otherwise  return  false.
Boolean Add (object obj.):-
Adds obj. to the  invoking  collection return true  if obj was added to collection otherwise  return  false.

Void clear ():-
Remove all elements from the invoking  collection

Boolean contains(object obj):-
Return true if obj is an element  of the invoking  collection.

Boolean is empty():-
Returns   true if the invoking  collection  is  empty.

Boolean remove(object obj):-
Remove are instance  of obj. from the  invoking collection.

                           Collection Classes

Abstract Collection:-
Implements  most  of   the  collection  interfaces .

Abstract List:-
Extends  Abstract  collection  &  implements  most  of   the list  intefaces'

Abstract Sequential List:-
Extends  abstract list.

Linked List:-
Implements  a linked  list  by  extending  abstract sequential list. It is Designed to give better performance when you insert or delete elements from the middle of the collection. 

Array List:-  
Implements  a dynamic  array  by extending   abstract list.

Abstract Set:-
Extends   abstract  coolection& implements  most of the  set  interface.

Hash Set:-
Extends  abstract  set   for  use  with  a hash table.It prevents duplictes in the collection  and it can find a given element quickly in a collection..

Linked Hash Set:-
Extends  hash  set to allow insertions.
Tree Set:-
Implements  a set  stored  in a  free  explicits and prevents the duplicates.



                                      

0 comments:

Post a Comment