I'm trying to find the index of an object placed in an array. The array has been populated like this
for(i = 0 ; i<n ;i++){
for(j=0; j<n ;j++){
squares[i][j]= new Square(i,j)
}
So the array is basically full of Square objects with no name. I want to make a method that returns the index of a square object, like:
getObject(Square s){
{
I've seen other answers calling for the use of
Arrays.asList(array)
And stuff like that, but they all try to return the index for an int or a String.
How should i go about returning the index for any object?