public boolean removeFirst(T data) {
        if (head == null) {
            return false;
        }
        if (head.getData().equals(data)) {
            if (head == tail) {
                head = null;
                tail = null;
            } else {
                head = head.getNext();
                head.setPrev(null);
            }
            length--;
            return true;
        }
        Link<T> temp = head.getNext();
        while (temp != null) {
            if (temp.getData().equals(data)) {
                temp.getPrev().setNext(temp.getNext());
                if (temp.getNext() != null) {
                    temp.getNext().setPrev(temp.getPrev());
                }
                length--;
                return true;
            }
            temp = temp.getNext();
        }
        return false;
    }