public int indexOf(Object o) {
        int index = 0;
        if (o == null) {
            for (Node current=head; current!=null; current=current.next) {
                if (current.data == null)
                    return index;
                index++;
            }
        } else {
            for (Node current=head; current!=null; current=current.next) {
                if (o.equals(current.data))
                    return index;
                index++;
            }
        }
        return -1;
    }