Insert at front of list
(value: T)
| 725 | |
| 726 | /** Insert at front of list */ |
| 727 | unshift(value: T) { |
| 728 | this.count += 1; |
| 729 | const newNode: ListNode<T> = { |
| 730 | next: this.head.next as ListNode<T>, |
| 731 | prev: this.head as HeadNode<T>, |
| 732 | value |
| 733 | }; |
| 734 | this.head.next.prev = newNode; |
| 735 | this.head.next = newNode; |
| 736 | } |
| 737 | |
| 738 | private remove(node: ListNode<T> | EmptyNode): T | null { |
| 739 | if (node === this.head || this.length === 0) { |
no outgoing calls
no test coverage detected