假设有一个单链表:1-> 2-> 3-> 4-> null
单链表的定义:
public class ListNode {
int val;
ListNode next;
ListNode(int x) {
val = x;
next = null;
}
}
Run Code Online (Sandbox Code Playgroud)
如果我想从头到尾逐个打印节点值,我需要迭代地使用head = head.next,直到head == null.在这种情况下,我们永远不会在打印后返回到head(value = 1)节点.我的问题是如何在遍历单链表时保持头部?
[UIAlertView alertViewWithTitle:@"" message:@"Submit successfully!" cancelBlock:^(NSInteger buttonIndex) {
} dismissBlock:nil cancelButtonTitle:@"OK" otherButtonsTitles:nil, nil];
Run Code Online (Sandbox Code Playgroud)
这是UIAlertView声明.但是,我希望进行UI测试cancelButton.
[tester tapViewWithAccessibilityLabel:@"cancelButton"];
Run Code Online (Sandbox Code Playgroud)
我该如何为cancelButton添加辅助功能?