public final int getIndexOfChild(Node child) {
    Node n = first;
    int i = 0;
    while (n != null) {
      if (child == n) {
        return i;
      }

      n = n.next;
      i++;
    }
    return -1;
  }
public final int getIndexOfChild ( Node child ) { Node n = first ; int i = 0 ; while ( n != null ) { if ( child == n ) { return i ; } n = n . next ; i ++ ; } return - 1 ; }
Gets the index of a child, note that this is O(N) where N is the number of children.

@param child The child
@return The index of the child