Translate

Sunday, November 25, 2012

COLLECTIONS FRAME WORK-02



3) Set interface :

This can be used for representing a group of individual objects where duplicate objects are not allowed and insertion operation is not preserved.

This is the child interface of collection

hashset and linkedHashSet are the classes which implements Set interface directly.

4) SortedSet interface :

This can be used for representing a group of individual and unique objects. Where all the objects are inserted in some sorting order. It is the child interface of Set interface TreeSet is the implemented class of SortedSet



5) Queue interface:

It is the child interface of collection it has introduced in 1.5 version this interface can be used for representing a group of individual objects prior to processing.




All the above interfaces(collection, List, Set, SortedSet, Queue) can be used for representing a group of individual objects.
If u want to represent a group of objects as key value pair than we can’t use above interfaces.

To handle this requirement sun people has introduced map interface.

6) Map:

This can be used for representing a group of objects as key value pairs. Both key and value are objects only.
StudentName à StudentRollNo
phoneNumber à contactdetails
word à meaning
IP Address à Domain-name

Map interface is not child interface of collection.






7) SortedMap:

This can be used for representing a group of objects as key value pairs where all the entries are arranged in some sorting order of keys.

TreeMap is the class which implements SortedMap interface.
The following are legacy Characters in collection Frame Work.

TreeMap
1) vector.
2) stack
3) Hashtable      Concrete classes

4) properties

5) Dictionary à abstract classes
6) Enumaration à interface

No comments: