public void addFirst(Item item) {
        if (item == null)
            throw new NullPointerException();
        if (isEmpty()) {
            first = new Node<Item>();
            last = new Node<Item>();
            first.item = item;
            last = first;
        } else {
            Node<Item> node = new Node<Item>();
            node.item = item;
            node.next = first;
            first.prev = node;
            node.prev = null;
            first = node;
        }
        size++;
    }