Java HashMap with Int Array
Posted
by Sunil
on Stack Overflow
See other posts from Stack Overflow
or by Sunil
Published on 2010-04-13T08:03:04Z
Indexed on
2010/04/13
8:23 UTC
Read the original article
Hit count: 262
java
Hello I am using this code to check that array is present in the HashMap.
public class Test {
public static void main(String[]arg)
{
HashMap<int[],String> map= new HashMap<int[],String>();
map.put(new int[]{1,2}, "sun");
System.out.println(map.containsKey((new int[]{1,2})));
}
}
But this prints False. How can I check that array is present in the HashMap. Thanks in advance.
© Stack Overflow or respective owner