Sollicitatievraag bij Capgemini

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

Antwoord op sollicitatievraag

Anoniem

28 mei 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.