Let's say that I've got a Hashmap
and I would like array of two Integer
s to actually be the key of each value. I can't figure out how to get the correct value back. It should already be stored in the Hashmap
public class Mapky {
public static void main(String[] args) {
HashMap<Integer[], String> mapka = new HashMap<>();
mapka.put(new Integer[]{10,23}, "Hello");
System.out.println(mapka.get(new Integer[]{10,23}));
}
}
Also why does this
System.out.println(new Integer[]{10,23}.equals(new Integer[]{10,23}));
return false
?