I have a program that needs to store a couple of simple int values ββand bind them to a string key. I am currently initializing this element as follows:
private Map<String, int[]> imageSizes = new HashMap<String, int[]>();
and then add to it something like imageSizes.put("some key", new int[]{100, 200});
My question is, is there a way to give these values ββa fixed length? I will need only 2 elements in each. Java doesn't like the syntax if I try to give arrays a length in a member definition.
Also, is there any use for limiting the length of the array in this case, or am I just overrated in my optimization?
source share