public int lastIndexOf(Object o) {
        int index = size;
        if (o == null) {
            for (Node x = tail; x != null; x = x.prev) {
                index--;
                if (x.data == null)
                    return index;
            }
        } else {
            for (Node x = tail; x != null; x = x.prev) {
                index--;
                if (o.equals(x.data))
                    return index;
            }
        }
        return -1;
    }