Is it possible to find the index of an array within an ArrayList?
The method indexOf doesn´t seem to work. For instance, for a given list of arrays with size two, this code prints "-1"
List<Integer[]> nodes = new ArrayList<Integer[]>();
nodes.add(new Integer[] {1,1});
System.out.println(nodes.indexOf(new Integer[] {1, 1}));
new Integer[] {1,1}creates a new integer object array, that is NOT saved at the same place where you first assigned it. It is not exactly the same and thus not in your list. (It's like asking where your neighbour John is working but the list only contains Johns from the neighbouring city, he is not in that list).