mirror of
https://github.com/zrwusa/data-structure-typed.git
synced 2024-11-23 12:54:04 +00:00
fix: Deque delete param correctly used
This commit is contained in:
parent
2634c99388
commit
a4a35731d2
|
@ -392,14 +392,14 @@ export class Deque<E> {
|
|||
}
|
||||
|
||||
delete(element: E) {
|
||||
const length = this.size;
|
||||
if (length === 0) return 0;
|
||||
const size = this.size;
|
||||
if (size === 0) return 0;
|
||||
let i = 0;
|
||||
let index = 0;
|
||||
while (i < length) {
|
||||
const element = this.getAt(i);
|
||||
if (element !== element) {
|
||||
this.setAt(index, element!);
|
||||
while (i < size) {
|
||||
const oldElement = this.getAt(i);
|
||||
if (oldElement !== element) {
|
||||
this.setAt(index, oldElement!);
|
||||
index += 1;
|
||||
}
|
||||
i += 1;
|
||||
|
|
Loading…
Reference in a new issue