0

Is List:ArrayList::Map:HashMap ?

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

1

5 Answers 5

6

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
Sign up to request clarification or add additional context in comments.

Comments

2

List and Map are interfaces their implementations are ArrayList and HashMap

Comments

2

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

Comments

1

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

Comments

0

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'.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.