How to fill in this HashMap neatly without code duplication?
Then I would use a static method to put the entries in the map:

HashMap&lt;String,MyClass&gt; myHashMap = new HashMap&lt;String,MyClass&gt;();
addEntry(myHashMap, "foo",2,4);
addEntry(myHashMap, "bar", 0,10);
addEntry(myHashMap, "a", 0,0);
addEntry(myHashMap, "b", 0,1);
addEntry(myHashMap, "c", 0,0);
addEntry(myHashMap, "d", 0,42);
// ...

private static //
void addEntry(HashMap&lt;String,MyClass&gt; map, String name, int arg1, int arg2){
  map.put( name, new MyClass(arg1,arg2) );
}


I recommend reading the data from a file and call addEntry(myHashMap, ...); in a loop until end of file is reached.