Pregunta de entrevista de Capgemini

When would you want to use a Map vs a HashMap in Java?

Respuesta de la entrevista

Anónimo

28 de may de 2020

HashMap is a more specific data type and therefore less general interface, if you were wanting a more general interface you would use Map. However inside the implementation HashMap and Map are equivalents, and Map will compile down to HashMap if a more specific data type is not specified.