I want to insert array into hashmap. When val of Integer type is created then I put to map is perfectly fine.
Integer[] val = {1,2};
LinkedHashMap<String, Integer[]> map = new LinkedHashMap<String, Integer[]>();
map.put("1", val);
But when I don't want to create a array and insert directly into map like this below
map.put("1", {1,2});
then its not correct. Why ? How this can be done?