Question: "Choose the class that can hold multiple equal objects in an ordered way. A. Map B. Collection C. List D. Set E. Vector" JXAM Correct Answer: C. My answer: E. My reasoning: java.util.List is an interface, not a class. Quote from Sun's javadoc for java.util.List: "Lists TYPICALLY allow duplicate elements." (my caps). Whereas Vector always does so.
Joined: Mar 06, 2001
In my research I don't see Vector as being part of the collections framework, whereas 'List' seems to be the best one to hold equal objects due to the phrase "in an ordered way". Percy
Joined: Jan 09, 2001
Hi Percy, Your research must not have been to in-depth. The Vector class is listed under See Also on the first page of the Collections API! In answer to the question posed by David, I think List would be the best choice. My reasoning: Vector just uses List functionality to perform its job! Regards, Manfred.
Joined: Jul 09, 2001
But List is an interface, not a class. How could it be the answer to the question?
Joined: Aug 30, 2000
All the selections, except Vector, are interfaces. The question could have been worded 'choose the type'. Lists allow duplicates, and a Vector 'is a' list. It was retro-fitted in JDK 1.2 to fit into the Collections framework. Hope that helps. ------------------ Jane Griscti Sun Certified Programmer for the Java� 2 Platform