public Item removeFirst() {
        if (isEmpty())
            throw new java.util.NoSuchElementException();
        else if (size() == 1) {
            Item item = first.item;
            first = null;
            last = null;
            size--;
            return item;
        }
        Item item = first.item;
        first = first.next;
        first.prev = null;
        size--;
        return item;
    }