I have an ArrayList filled with objects in a 2D Array. I want to get the indexes of the Object in the 2D Array at the index of the ArrayList. For example:
Object map[][] = new Object[2][2];
map[0][0] = Object a;
map[0][1] = Object b;
map[1][0] = Object c;
map[1][1] = Object d;
List<Object> key = new ArrayList<Object>();
key.add(map[0][0]);
key.add(map[0][1]);
key.add(map[1][0]);
key.add(map[1][1]);
What I want to do is:
getIndexOf(key.get(0)); //I am trying to get a return of 0 and 0 in this instance, but this is obviously not going to work
Does anyone know how I can get the indexes of the 2D array at a specific position? (The indexes are random). Let me know if you have any questions. Thanks!