Pergunta de entrevista da empresa Capgemini

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

Resposta da entrevista

Sigiloso

28 de mai. 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.