posted 19 years ago
OK , Let me try this ...
Collection - interface
It has two sub interface :
1] List
2] Set
List has three sub classes :
1] ArrayList
2] LinkedList
3] Vector
Set has two direct sub class :
1] HashSet
2] LinkedHashset
Set also has one indirect sub class , I mean to say it has a interface SortedSet & it has one sub class TreeSet .
Now come to Map , Although we call it collection but it has no relation with Collection .
Map - interface
It has 3 direct classes :
1] Hashtable
2] HashMap
3] LinkedHashMap
It also has one interface SortedMap that has one sub class TreeMap ( same like TreeSet )
Now total we have 10 collections . I am explaning all 10 in short , if you want more detail then specify that , I will again try to provide ...
All List has index-value pair . So all are ordered by index .
1] ArrayList => growable array , nothing special in this .
2] Vector => same as ArrayList but all the methods are synchronized in this case .
3] LinkedList => if you read data structure in your syllabus then probably you would be familiar with this . All element has two link , one is towords right element & one is towords left element .
Set just store one object in one row , no pair ( index-value , key-value ) type of thing in this . you can think like it just store values . They doesn't allow duplications .
1] HashSet => nothing special , not sorted , no order .
2] LinkedHashSet => not sorted ( only TreeSet is sorted ) yes but you can retrive values with insertion order or last access order .
3] TreeSet => sorted .
Map have key-value pair in one row . both are object . key should be unique in Map .
1] HashMap => nothing special , not sorted , no order .
2] Hashtable => same as HashMap , but mthods are synchronized here .
3] LinkedHashMap => same as LinkedHashSet , maintain order .
4] SortedMap => sorted .
Some Twos :
1] two collection have synchronized method :
Vector , Hashtable ( both were in 1.2 also )
2] two collection are sorted :
TreeSet , TreeMap
One Three :
3] three collection have elements that have two link :
LinkedList , LinkedHashSet , LinkedHashMap
I hope I didn't miss anything important in this . If missed then please put ...
[ February 04, 2005: Message edited by: rathi ji ]