I am trying to build a HashMap which will have integer as keys and objects as values.
My syntax is:
HashMap myMap = new HashMap&
Use Integer instead.
Integer
HashMap myMap = new HashMap();
Java will automatically autobox your int primitive values to Integer objects.
int
Read more about autoboxing from Oracle Java documentations.