Is List:ArrayList::Map:HashMap ?

And if not, what are the differences in how these relate to each other?

share|improve this question

46% accept rate
3  
Is this a homework question? – Robin Green May 4 '11 at 18:50
1  
Do you understand what a Map/List is? stackoverflow.com/questions/2395814/… – josh.trow May 4 '11 at 18:52
feedback

closed as not a real question by Brian Roach, Isaac Truett, Mat, ColinD, Jeremy Heiler May 4 '11 at 19:02

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, see the FAQ.

5 Answers

I believe an ArrayList implements the List interface and is a collection of objects which you can access using an index just like an 'array'.

HashMap implements the Map interface and maps keys to values just like a 'hashtable'.

share|improve this answer
feedback

Yes. Just as an ArrayList is an implementation of the List interface, similarly, HashMap is an implementation of the Map interface.

share|improve this answer
feedback

If you're asking whether or not HashMap implements the Map interface, like ArrayList implements the List interface, then yes.

public class ArrayList<E>
extends AbstractList<E>
implements List<E>, RandomAccess, Cloneable, Serializable

public class HashMap
extends AbstractMap
implements Map, Cloneable, Serializable
share|improve this answer
feedback

Yes. An ArrayList is a concrete implementation of a List, and a HashMap is a concrete implementation of a Map.

share|improve this answer
feedback

List and Map are interfaces their implementations are ArrayList and HashMap

share|improve this answer
feedback

Not the answer you're looking for? Browse other questions tagged or ask your own question.