Skip to content

Commit fa9a3c1

Browse files
committed
Refactor
1 parent 754a0cb commit fa9a3c1

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

data_structures/linked_list/doubly_linked_list.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,14 @@ class Node<T> {
1111
class 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.

data_structures/linked_list/linked_list.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@ class Node<T> {
1010
class 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.

data_structures/stack/linked_list_stack.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class Node<T> {
99

1010
class LinkedListStack<T> {
1111
Node<T>? _head;
12+
1213
int _size = 0;
1314

1415
T? get last => _head?.value;

0 commit comments

Comments
 (0)