/** * Find the tail of the chain. * Note, this is most efficient if this node is the head. * * @return the tail of the chain. */ public ChainLink<E> findTail() { return findHead().left; }
/** * Add this node as the tail of the chain. * Note, this is most efficient if anyNode is the head of the chain. * * @param anyNode any node in the chain */ public void addLast(ChainLink<E> anyNode) { ChainLink<E> node = anyNode.findHead(); addAfter(node.left); }
/** * Add this node as the head of the chain. * Note, this is most efficient if anyNode is the head of the chain. * * @param anyNode any node in the chain */ public void addFirst(ChainLink<E> anyNode) { ChainLink<E> node = anyNode.findHead(); addBefore(node); }