Which ways are legit for declaring and initializing a HashMap?

HashMap<String, String> map;
map = new HashMap<>();
HashMap<String, String> map;
map = new HashMap<String, String>();
HashMap<String> map;
map = new HashMap<>();
HashMap<String> map;
map = new HashMap<String>();

Great! A HashMap can take any type except primitive types. Using the diamond, we don't have to re-specify the types upon initialization.

So close! A HashMap can take any type except primitive types. Using the diamond, we don't have to re-specify the types upon initialization.