File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed
src/data-structures/circular-doubly-linked-list Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -617,14 +617,15 @@ class CircularDoublyLinkedList {
617617 * allows execution to stop and not pick up again until the iterator's
618618 * `next()` method is called again.
619619 *
620- * It's possible for this loop to exit if the list is emptied
621- * in between calls to the iterator's `next()` method. That will
622- * cause `current` to be `null` and the iterator will close.
620+ * It's not possible for this loop to exit. Even removing all nodes
621+ * from the list using `remove()` or `clear()` will not cause the
622+ * loop to stop yield values. That's because `current.next` always
623+ * has a value, even if it just points back to `current`.
623624 */
624625 do {
625626 yield current . data ;
626627 current = current . next ;
627- } while ( current !== null ) ;
628+ } while ( true ) ;
628629 }
629630
630631 }
Original file line number Diff line number Diff line change 11{
22 "name" : " @humanwhocodes/circular-doubly-linked-list" ,
3- "version" : " 2.0.1 " ,
3+ "version" : " 2.0.2 " ,
44 "description" : " A circular doubly linked list implementation in JavaScript" ,
55 "main" : " circular-doubly-linked-list.js" ,
66 "scripts" : {
You can’t perform that action at this time.
0 commit comments