File tree Expand file tree Collapse file tree 3 files changed +5
-6
lines changed
Expand file tree Collapse file tree 3 files changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -11,15 +11,14 @@ class Node<T> {
1111class DoubleLinkedList <T > extends Iterable <T > {
1212 int _length = 0 ;
1313
14+ Node <T >? _head, _tail;
15+
1416 @override
1517 int get length => this ._length;
1618
1719 @override
1820 Iterator <T > get iterator => _LinkedListIterator <T >(this ._head);
1921
20- Node <T >? _head;
21- Node <T >? _tail;
22-
2322 /// Pseudocode:
2423 /// - Create a new node with the value passed to the function.
2524 /// - If the list is empty, set the head and tail to be the newly created node.
Original file line number Diff line number Diff line change @@ -10,15 +10,14 @@ class Node<T> {
1010class LinkedList <T > extends Iterable <T > {
1111 int _length = 0 ;
1212
13+ Node <T >? _head, _tail;
14+
1315 @override
1416 int get length => this ._length;
1517
1618 @override
1719 Iterator <T > get iterator => _LinkedListIterator <T >(this ._head);
1820
19- Node <T >? _head;
20- Node <T >? _tail;
21-
2221 /// Pseudocode:
2322 /// - This function should accept a value.
2423 /// - Create a new node using the value passed to the function.
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ class Node<T> {
99
1010class LinkedListStack <T > {
1111 Node <T >? _head;
12+
1213 int _size = 0 ;
1314
1415 T ? get last => _head? .value;
You can’t perform that action at this time.
0 commit comments