Method
addFirst
(LinkedList.Node<T> tNode)
Source from the content-addressed store, hash-verified
| 9 | private int size; |
| 10 | |
| 11 | public void addFirst(LinkedList.Node<T> tNode) { |
| 12 | this.checkNoParent(tNode); |
| 13 | |
| 14 | if (this.isEmpty()) { |
| 15 | this.first = tNode; |
| 16 | this.last = tNode; |
| 17 | } else { |
| 18 | LinkedList.Node<T> node = this.first; |
| 19 | tNode.setNext(node); |
| 20 | node.setPrev(tNode); |
| 21 | this.first = tNode; |
| 22 | } |
| 23 | |
| 24 | tNode.setParent(this); |
| 25 | ++this.size; |
| 26 | } |
| 27 | |
| 28 | public void addLast(LinkedList.Node<T> tNode) { |
| 29 | this.checkNoParent(tNode); |