@Test public void testInsertAfter() { try { this.list.insertAfter( null, this.node1 ); } catch (NullPointerException e) { e.printStackTrace(); fail("Should NOT raise NPE!"); } }
public void insertAfter(final T existingNode, final T newNode) { if ( newNode.getPrevious() != null || newNode.getNext() != null ) { return; } if ( existingNode == null ) { if ( this.isEmpty() ) { this.firstNode = newNode; this.lastNode = newNode; } else { final T node = this.firstNode; node.setPrevious( newNode ); newNode.setNext( node ); this.firstNode = newNode; } } else if ( existingNode == this.lastNode ) { existingNode.setNext( newNode ); newNode.setPrevious( existingNode ); this.lastNode = newNode; } else { (existingNode.getNext()).setPrevious( newNode ); newNode.setNext( existingNode.getNext() ); existingNode.setNext( newNode ); newNode.setPrevious( existingNode ); } this.size++; }
LinkedList implements
    Externalizable { public void insertAfter(final T existingNode, final T newNode) { if ( newNode.getPrevious() != null || newNode.getNext() != null ) { return; } if ( existingNode == null ) { if ( this.isEmpty() ) { this.firstNode = newNode; this.lastNode = newNode; } else { final T node = this.firstNode; node.setPrevious( newNode ); newNode.setNext( node ); this.firstNode = newNode; } } else if ( existingNode == this.lastNode ) { existingNode.setNext( newNode ); newNode.setPrevious( existingNode ); this.lastNode = newNode; } else { (existingNode.getNext()).setPrevious( newNode ); newNode.setNext( existingNode.getNext() ); existingNode.setNext( newNode ); newNode.setPrevious( existingNode ); } this.size++; } }
LinkedList implements
    Externalizable { public void insertAfter(final T existingNode, final T newNode) { if ( newNode.getPrevious() != null || newNode.getNext() != null ) { return; } if ( existingNode == null ) { if ( this.isEmpty() ) { this.firstNode = newNode; this.lastNode = newNode; } else { final T node = this.firstNode; node.setPrevious( newNode ); newNode.setNext( node ); this.firstNode = newNode; } } else if ( existingNode == this.lastNode ) { existingNode.setNext( newNode ); newNode.setPrevious( existingNode ); this.lastNode = newNode; } else { (existingNode.getNext()).setPrevious( newNode ); newNode.setNext( existingNode.getNext() ); existingNode.setNext( newNode ); newNode.setPrevious( existingNode ); } this.size++; } LinkedList();  LinkedList(final T node); }
LinkedList implements
    Externalizable { public void insertAfter(final T existingNode, final T newNode) { if ( newNode.getPrevious() != null || newNode.getNext() != null ) { return; } if ( existingNode == null ) { if ( this.isEmpty() ) { this.firstNode = newNode; this.lastNode = newNode; } else { final T node = this.firstNode; node.setPrevious( newNode ); newNode.setNext( node ); this.firstNode = newNode; } } else if ( existingNode == this.lastNode ) { existingNode.setNext( newNode ); newNode.setPrevious( existingNode ); this.lastNode = newNode; } else { (existingNode.getNext()).setPrevious( newNode ); newNode.setNext( existingNode.getNext() ); existingNode.setNext( newNode ); newNode.setPrevious( existingNode ); } this.size++; } LinkedList();  LinkedList(final T node); void readExternal(ObjectInput in); void writeExternal(ObjectOutput out); void add(final T node); void addLast(final T node); void addFirst(final T node); void remove(final T node); boolean contains(T node); final T getFirst(); final T getLast(); T removeFirst(); void insertAfter(final T existingNode,
                            final T newNode); T removeLast(); T get(int i); final boolean isEmpty(); void clear(); final int size(); int hashCode(); boolean equals(final Object object); FastIterator iterator(); FastIterator fastIterator(); java.util.Iterator<T> javaUtilIterator(); }
LinkedList implements
    Externalizable { public void insertAfter(final T existingNode, final T newNode) { if ( newNode.getPrevious() != null || newNode.getNext() != null ) { return; } if ( existingNode == null ) { if ( this.isEmpty() ) { this.firstNode = newNode; this.lastNode = newNode; } else { final T node = this.firstNode; node.setPrevious( newNode ); newNode.setNext( node ); this.firstNode = newNode; } } else if ( existingNode == this.lastNode ) { existingNode.setNext( newNode ); newNode.setPrevious( existingNode ); this.lastNode = newNode; } else { (existingNode.getNext()).setPrevious( newNode ); newNode.setNext( existingNode.getNext() ); existingNode.setNext( newNode ); newNode.setPrevious( existingNode ); } this.size++; } LinkedList();  LinkedList(final T node); void readExternal(ObjectInput in); void writeExternal(ObjectOutput out); void add(final T node); void addLast(final T node); void addFirst(final T node); void remove(final T node); boolean contains(T node); final T getFirst(); final T getLast(); T removeFirst(); void insertAfter(final T existingNode,
                            final T newNode); T removeLast(); T get(int i); final boolean isEmpty(); void clear(); final int size(); int hashCode(); boolean equals(final Object object); FastIterator iterator(); FastIterator fastIterator(); java.util.Iterator<T> javaUtilIterator(); static final FastIterator fastIterator; }