File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes collections framework Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "collections framework" Watch "collections framework" New topic
Author

collections framework

shandilya popuru
Ranch Hand

Joined: Dec 21, 2004
Posts: 95
can anyone give a good refrence for collections framework


sandy
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
http://java.sun.com/j2se/1.4.2/docs/api/


42
Jay Pawar
Ranch Hand

Joined: Aug 27, 2004
Posts: 411
Originally posted by shandilya popuru:
can anyone give a good refrence for collections framework


Here you go
Lists
Set
Map
Collections class

Collection Java Sun Tutorial

HTH


Cheers,<br />Jay<br /> <br />(SCJP 1.4)<br />Heights of great men were not achieved in one day, they were toiling day and night while their companions slept.
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
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 ]
shandilya popuru
Ranch Hand

Joined: Dec 21, 2004
Posts: 95
great explanation rathi ji

and the links provided by jay pawar were really helpful

thanks a lot, i was weak in collections framework and k&b doesnt go into the implementation of them or the api, those links had everything i wanted
Jay Pawar
Ranch Hand

Joined: Aug 27, 2004
Posts: 411
Originally posted by shandilya popuru:
great explanation rathi ji

and the links provided by jay pawar were really helpful

thanks a lot, i was weak in collections framework and k&b doesnt go into the implementation of them or the api, those links had everything i wanted


Honestly... , if you are just targeting to clear the SCJP 1.4 exam. K&B book is more than sufficient. You do not have to memorize the API for each of the interface.
Just keep in mind Set do not allow duplicates and List do.
The table in the collection chapter of K&B book is all you should know to tackle the questions in the exam.

The links I provided will definitely give you more knowledge than what is intended for clearing the exam. The choice is yours..

Hope that helps
Jay Pawar
Ranch Hand

Joined: Aug 27, 2004
Posts: 411
Originally posted by rathi ji:

LinkedList , LinkedHashSet ( Please any body confirm about LinkedHashMap )



LinkedHashMap maintains a doubly-linked list of the entries. The order is usually in which the keys were inserted ( insertion-order ). This implementation is not synchronized.
shandilya popuru
Ranch Hand

Joined: Dec 21, 2004
Posts: 95
thanks jay
i was worried about it cos i found questions related to api in some of the mocks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: collections framework
 
Similar Threads
problems in collectins and generics
Collection Framework
a question about Collection framework?
Where can i find help on the new 1.4 exam topics ?
Collections