I recently took the Whizlabs Diagnostic exam and it pointed out 2 areas which I really need to focus on. I've used the K&B book but espesally in the area of Collections I dont feel I'm quite memorizing the material. While the individual concepts and process is fine, recalling it i'm having terrible trouble.
My weak areas were Collections/Generics and API. I know that this equates to basically chapters 6 and 7 in the book of which I've had a terrible time from the start.
I've written programs to use the information in the book but gosh darnit the information wont stick!
I imagine i'm not the only one to have trouble in these areas. Has anyone had success learning this material elsewhere?
Anyone out there willing to mentor me in the area? At this point I'll try anything to get a better grasp of it.
I think the biggest problem is just trying to remember "what does what" with collections. Generics kick my butt in knowing "who does what" and the API I just cant remember those darn methods. I've tried simple memorization and practice but with no luck.
Genuine and often found problem! Anyways, which sections give you trouble? I think picking methods and using them in your programs you write for practice is the one of the good ways to learn them. If something is not entering into brain by reading, what not practicing it. When things become matter of daily practice, they are no more material to reading.
Anyways, post your doubts here, we have so many experts here to answer. I will try too to answer your doubts. You pick any one topic and make a well start from that!!!
Well the one I think I'm weakest on is the Collections as far as what does what. Page 545 of the book has an excellent table however when I read through "what does what" and even try to apply it I can never seem to pick the right one.
HashMap, Hashtable, TreeMap, LinkedHashMap, HashSet, TreeSet, LinkedHashSet, ArrayList, Vector, LinkedList, PriorityQueue are in the list of items for the test.
Queue and LinkedList I think I'm somewhat familiar with. Most testing seems to ask about the LinkedList allowing the Queue interface for offer() and poll(). I'm good with that.
I understand Vector is the thread-safe version of arraylist. I understand Key/Value pairs in the Maps. Sets are unique. This all makes sense to me.
Where I ran into trobule today was with 2 specific questions that smoked me:
Q1: Which collection class ofers constant-time performance for the basic operations add() remove() contains() and size().
Q2: You have a hashmap whos keys need to be retreived in a sorted manner. Which of the following will help you achive this?
Copy the contents of the hashmap into a treemap or add the keys of the hashmap to a treeset.
-- Q1 just smoked me. I spaced completely Q2 however I got 1 of 2 correct. The second one I just couldnt understand how a map got into a treeset since maps are k/v based. So to not see the answer there eludes me since I'm not sure how to do it. The treemap I thought was kind of a gimmie since it obviously was a sort map. (rememberign that both treemap and treeset are sorted).