New to Java, when I want to initialize a HashMap. I can find these two solutions:
Map<String, String> myMap = HashMap<String, String>;
HashMap<String, String> myMap = HashMap<String, String>;
I know Map is an interface, and HashMap implements it. But why we have two here? and what's the benefit for each of them?