Drawing order of Objects in an Arraylist

It seems that I cant sort out how to use Z to define wich object im clicking…

for the detection if my mouse is over i use a Boolean inside the main class “Garden Object”

 boolean isInside (float mx, float my) {
    return x-s/2<=mx && mx<=x+s/2 &&
      y-s/2<=my && my<=y+s/2;
  }

x and y are the positions, s is the size and mx and my would be mouseX and mouseY.

to actually delete the Object im currently using this in the main program:

//Remove clicked Object
void mouseClicked() {

  if (ButtonState == 4) {

    for (int i=0; i<gardenobjects.size(); i++) {
      if (gardenobjects.get(i).isInside(mouseX, mouseY)) {
        gardenobjects.remove(i);
        i--;
      }
    }
  }
}

how could I use Z in there to only delete the first object my mouse is over?