-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathListNode.java
More file actions
23 lines (20 loc) · 535 Bytes
/
ListNode.java
File metadata and controls
23 lines (20 loc) · 535 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package utils;
public class ListNode {
public int value;
public ListNode next;
public ListNode(int value) {
this.value = value;
}
public static void print(ListNode head) {
if (head == null) {
System.out.println("空链表");
return;
}
ListNode curListNode = head;
while (curListNode != null) {
System.out.print(curListNode.value + "->");
curListNode = curListNode.next;
}
System.out.println("NULL");
}
}