/** * Removes the specified node from the list. * * @param node the node to remove * @throws NullPointerException if <code>node</code> is null */ @Override protected void removeNode(final Node<E> node) { super.removeNode(node); broadcastNodeRemoved(node); }
public E removeLast() { final Node<E> node = header.previous; if (node == header) { throw new NoSuchElementException(); } final E oldValue = node.getValue(); removeNode(node); return oldValue; }
/** * Removes the node from the list, storing it in the cache for reuse * if the cache is not yet full. * * @param node the node to remove */ @Override protected void removeNode(final Node<E> node) { super.removeNode(node); addNodeToCache(node); }
public E removeFirst() { final Node<E> node = header.next; if (node == header) { throw new NoSuchElementException(); } final E oldValue = node.getValue(); removeNode(node); return oldValue; }
@Override public void remove() { checkModCount(); if (current == next) { // remove() following previous() next = next.next; parent.removeNode(getLastNodeReturned()); } else { // remove() following next() parent.removeNode(getLastNodeReturned()); nextIndex--; } current = null; expectedModCount++; }
@Override public boolean remove(final Object value) { for (Node<E> node = header.next; node != header; node = node.next) { if (isEqualValue(node.getValue(), value)) { removeNode(node); return true; } } return false; }
@Override public E remove(final int index) { final Node<E> node = getNode(index, false); final E oldValue = node.getValue(); removeNode(node); return oldValue; }
/** * Removes the item last returned by this iterator. * <p> * There may have been subsequent alterations to the list * since you obtained this item, however you can still remove it. * You can even remove it if the item is no longer in the main list. * However, you can't call this method on the same iterator more * than once without calling next() or previous(). * * @throws IllegalStateException if there is no item to remove */ @Override public void remove() { // overridden, as the nodeRemoved() method updates the iterator // state in the parent.removeNode() call below if (current == null && currentRemovedByAnother) { // NOPMD // quietly ignore, as the last returned node was removed // by the list or some other iterator // by ignoring it, we keep this iterator independent from // other changes as much as possible } else { checkModCount(); parent.removeNode(getLastNodeReturned()); } currentRemovedByAnother = false; }