📄 linkedlistdemo.java
字号:
package c10;
public class LinkedListDemo {
/**
* @param args
*/
public static void main(String[] args) {
// StringLinkedListSelfcontained list = new StringLinkedListSelfcontained();
StringLinkedListWithIterator list = new StringLinkedListWithIterator();
list.addANodeToStart("one");
list.addANodeToStart("two");
list.addANodeToStart("three");
System.out.println("List has " + list.length() + "entries");
list.showList();
list.resetIteration();
while(list.moreToIterate()){
if (list.getDataAtCurrent().equals("two")){
list.insertNodeAfterCurrent("added data");
break;
}
list.goToNext();
}
list.showList();
// if(list.onList("three")){
// System.out.println("three is on list.");
// }else{
// System.out.println("three is NOT on list.");
// }
//
// list.deleteHeadNode();
//
// if(list.onList("three")){
// System.out.println("three is on list after deleted the head node.");
// }else{
// System.out.println("three is NOT on list after deleted the head node.");
// }
// list.showList();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -