I found this in one of the mock exams. Could anyone clarify this? Which of these implementations for collections framework interfaces are provided in the standard JDK? (first of all I am not comfortable/clear with this question..!! ) Treemap ArrayMap HashSet ArrayList Vector the answer given is Treemap,ArrayList and Vector..
Ada Wang
Greenhorn
Joined: Aug 28, 2000
Posts: 23
posted
0
when you look up Java API documentation, you will notice the following classes are existed: Treemap HashSet ArrayList Vector There is no Arraymap class.
Paul A
Ranch Hand
Joined: Aug 25, 2000
Posts: 44
posted
0
As you are aware, Collection interfaces are 'interfaces'. You need concrete implementations of these interfaces to use. Standard JDK also provides some classes that implement these interfaces. This is what the question is trying to ask. Different implementations solve different purposes. For eg. HashMap and TreeMap both implement Map interface but their internal data structure is different which affects their performance in different cases. HashMap is faster to store and retireve but TreeMap is faster for ordering the elements. It's a good idea, IMHO, to read the description of these classes. -Paul. ------------------ http://pages.about.com/jqplus Get Certified, Guaranteed!
Thanks Paul and Wang. But If the question tries is to identify the classes in JDK that implements Collections interfaces, then why Hashset(which implements Set) is not included in the answer list?(only Treemap, ArrayList and Vector are answers!!) Thanks, Baskaran.