repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
build(deps-dev): apply updates
[poolifier.git]
/
src
/
deque.ts
diff --git
a/src/deque.ts
b/src/deque.ts
index 257643726383945d81960ec2cd7be0c04d26eecb..0d55f5b665115b3c5efc2580fcdb56562926b340 100644
(file)
--- a/
src/deque.ts
+++ b/
src/deque.ts
@@
-38,10
+38,11
@@
export class Deque<T> {
* @returns The new size of the queue.
*/
public push (data: T): number {
* @returns The new size of the queue.
*/
public push (data: T): number {
- const node
= { data, prev: this.tail
}
+ const node
: ILinkedListNode<T> = { data
}
if (this.tail == null) {
this.head = this.tail = node
} else {
if (this.tail == null) {
this.head = this.tail = node
} else {
+ node.prev = this.tail
this.tail = this.tail.next = node
}
return this.incrementSize()
this.tail = this.tail.next = node
}
return this.incrementSize()
@@
-54,10
+55,11
@@
export class Deque<T> {
* @returns The new size of the queue.
*/
public unshift (data: T): number {
* @returns The new size of the queue.
*/
public unshift (data: T): number {
- const node
= { data, next: this.head
}
+ const node
: ILinkedListNode<T> = { data
}
if (this.head == null) {
this.head = this.tail = node
} else {
if (this.head == null) {
this.head = this.tail = node
} else {
+ node.next = this.head
this.head = this.head.prev = node
}
return this.incrementSize()
this.head = this.head.prev = node
}
return this.incrementSize()