/** * Removes the specified node from the list. * * @param node the node to remove * @throws NullPointerException if <code>node</code> is null */ protected void removeNode(Node node) { super.removeNode(node); broadcastNodeRemoved(node); }
public Object removeFirst() { Node node = header.next; if (node == header) { throw new NoSuchElementException(); } Object 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 */ protected void removeNode(Node node) { super.removeNode(node); addNodeToCache(node); }
public Object removeLast() { Node node = header.previous; if (node == header) { throw new NoSuchElementException(); } Object oldValue = node.getValue(); removeNode(node); return oldValue; }
public Object removeLast() { Node node = header.previous; if (node == header) { throw new NoSuchElementException(); } Object oldValue = node.getValue(); removeNode(node); return oldValue; }
public Object removeFirst() { Node node = header.next; if (node == header) { throw new NoSuchElementException(); } Object oldValue = node.getValue(); removeNode(node); return oldValue; }
/** * Removes the specified node from the list. * * @param node the node to remove * @throws NullPointerException if <code>node</code> is null */ protected void removeNode(Node node) { super.removeNode(node); broadcastNodeRemoved(node); }
/** * 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 */ protected void removeNode(Node node) { super.removeNode(node); addNodeToCache(node); }
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++; }
public boolean remove(Object value) { for (Node node = header.next; node != header; node = node.next) { if (isEqualValue(node.getValue(), value)) { removeNode(node); return true; } } return false; }
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++; }
public Object remove(int index) { Node node = getNode(index, false); Object oldValue = node.getValue(); removeNode(node); return oldValue; }
public boolean remove(Object value) { for (Node node = header.next; node != header; node = node.next) { if (isEqualValue(node.getValue(), value)) { removeNode(node); return true; } } return false; }
public Object remove(int index) { Node node = getNode(index, false); Object 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 */ public void remove() { // overridden, as the nodeRemoved() method updates the iterator // state in the parent.removeNode() call below if (current == null && currentRemovedByAnother) { // 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; }
/** * 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 */ public void remove() { // overridden, as the nodeRemoved() method updates the iterator // state in the parent.removeNode() call below if (current == null && currentRemovedByAnother) { // 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; }
public void testRemoveNode() { resetEmpty(); if (isAddSupported() == false || isRemoveSupported() == false) return; AbstractLinkedList list = (AbstractLinkedList) collection; list.addAll( Arrays.asList( new String[]{"value1", "value2"})); list.removeNode(list.getNode(0, false)); checkNodes(); assertEquals("value2", list.getFirst()); assertEquals("value2", list.getLast()); list.addFirst("value1"); list.addFirst("value0"); checkNodes(); list.removeNode(list.getNode(1, false)); assertEquals("value0", list.getFirst()); assertEquals("value2", list.getLast()); checkNodes(); list.removeNode(list.getNode(1, false)); assertEquals("value0", list.getFirst()); assertEquals("value0", list.getLast()); checkNodes(); }
list.addFirst("value0"); checkNodes(); list.removeNode(list.getNode(1, false)); checkNodes(); try {
/** * Removes the specified node from the list. * * @param node the node to remove * @throws NullPointerException if <code>node</code> is null */ protected void removeNode(Node node) { super.removeNode(node); broadcastNodeRemoved(node); }
public Object remove(int index) { Node node = getNode(index, false); Object oldValue = node.getValue(); removeNode(node); return oldValue; }