Re: Constructing a HashMap

The short answer is: very little.

The slightly longer answer is: ArrayList is a List, and HashMap is a Map. List and Map are interfaces. Other things can also be Lists, and other things can also be Maps. It's generally a good idea to save things as non-specific as possible (so Map instead of HashMap), because it makes it much easier to go back and make changes later. This is called "programming to interfaces". List and Map are both interfaces.

For example, say you have a class that contains a HashMap, and then a bunch of methods that take a HashMap as a parameter. But then you want to change that HashMap to a different kind of Map (say a TreeMap). Now you have to change not only the variable declaration, but also every single method that uses it. If instead you had saved the HashMap as a Map reference, and the methods had taken Map arguments as parameters, you would only have to make that change in one place.