I'm trying to create a map of Integer vs Integer using Groovy literals i.e
Map<Integer, Integer> map = [1:10, 2:30, -3:32]
Well as stated in the groovy docs any non-string Map key should be specified in circular brackets().
So you can create the map as below
Map sampleMap = [:] sampleMap << [(1): 3]
You can access this maps key- values as we access normaly.
We can even have the variables as key
String mapKey = "firstKey" sampleMap << [ (mapKey) : 5] println sampleMap[mapKey]