You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
349 B
22 lines
349 B
2 years ago
|
/**
|
||
|
* File: PrintUtil
|
||
|
* Created Time: 2023-01-23
|
||
|
* Author: Jefferson (JeffersonHuang77@gmail.com)
|
||
|
*/
|
||
|
|
||
|
import 'ListNode.dart';
|
||
|
|
||
|
class PrintUtil {
|
||
|
|
||
|
void printLinkedList(ListNode? head) {
|
||
|
List<String> list = [];
|
||
|
|
||
|
while (head != null) {
|
||
|
list.add('${head.val}');
|
||
|
head = head.next;
|
||
|
}
|
||
|
|
||
|
print(list.join(' -> '));
|
||
|
}
|
||
|
}
|