I have a question about Java maps. I use map to contain array, and I want to check whether the map contains the array I want. But it does not work. Is there anyway to check whether the map contains the the array I want?
import java.util.*;
public class testContainKey{
static Map<int[],Integer> map = new HashMap<int[], Integer>();
public static void main(String args[]){
int[] initial={1,2,3,4,5,6,7,8,9};
int[] goal = {1,2,3,4,5,6,7,8,9};
map.put(goal,0);
if(map.containsKey(array)){
System.out.println("OK");
}
else{
System.out.println("Not works");
}
}
}