X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=inline;f=src%2Fdeque.ts;h=0d55f5b665115b3c5efc2580fcdb56562926b340;hb=9b2a9f3fda43bb1663ddf5d5dfcbaaa866d8925a;hp=257643726383945d81960ec2cd7be0c04d26eecb;hpb=b97b9dc23cec0006fb59ac15197d666307ab8cf5;p=poolifier.git diff --git a/src/deque.ts b/src/deque.ts index 25764372..0d55f5b6 100644 --- a/src/deque.ts +++ b/src/deque.ts @@ -38,10 +38,11 @@ export class Deque { * @returns The new size of the queue. */ public push (data: T): number { - const node = { data, prev: this.tail } + const node: ILinkedListNode = { data } if (this.tail == null) { this.head = this.tail = node } else { + node.prev = this.tail this.tail = this.tail.next = node } return this.incrementSize() @@ -54,10 +55,11 @@ export class Deque { * @returns The new size of the queue. */ public unshift (data: T): number { - const node = { data, next: this.head } + const node: ILinkedListNode = { data } if (this.head == null) { this.head = this.tail = node } else { + node.next = this.head this.head = this.head.prev = node } return this.incrementSize()