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

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Collection doubt" Watch "Collection doubt" New topic

Collection doubt

Veena Pointi
Ranch Hand

Joined: Jun 20, 2002
Posts: 442
I came a/c the following code while giving mock exams

Do we need to study api(I mean methods) of all collection classes for the purpose of the exam?

"Continuous effort - not strength or intelligence - is the key to unlocking our potential."
*Winston Churchill
Bert Bates

Joined: Oct 14, 2002
Posts: 8898
Veena -
I'm not sure I understand how your code listing applies to your question, sorry. But I can tell you this much:
For collections you need to understand the purposes and features of these:
Collection, Map, Sorted Map, Set, Sorted Set, List
And you need to understand the purposes and features of these:
HashSet, LinkedHashSet, TreeSet, LinkedList, Vector, ArrayList, Hashtable, LinkedHashMap, HashMap, TreeMap.
You also need to understand how iterators work.
You don't need to know all the methods, it's really about why would you use one vs. another. Which ones allow dups, which ones are ordered...

Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
Veena Pointi
Ranch Hand

Joined: Jun 20, 2002
Posts: 442
Thanks Bert.
Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
Just to add to what Bert said ...
You must be clear about the purpose of the classes and interfaces. Suppose, for instance, you are looking at LinkedList and ArrayList: which would be more suitable if:
1. You are mainly adding elements to the end of the list
2. You are mainly adding elements not to the end of the list
3. You are mainly retrieving elements by using an index
4. You are mainly deleting elements from the list
5. You need to implement a FIFO queue
6. You need to implement a pushdown stack
7. You need to implement an LRU cache
8. You need to implement a map
9. You need to implement a set
[ September 14, 2003: Message edited by: Roger Chung-Wee ]

SCJP 1.4, SCWCD 1.3, SCBCD 1.3
Barkat Mardhani
Ranch Hand

Joined: Aug 05, 2002
Posts: 787
Hi Bert,
Can we also assume that exam expects you to know Collection good enough you can read and understand code littered with collections easily. So that you can answer other questions testing some other skills.
Just like anonymous classes. As you book says that exam is littered with code involving these classes while testing knowledge some other area.
jQuery in Action, 3rd edition
subject: Collection doubt
It's not a secret anymore!