linkedlistdemo.java

来自「本压缩文件中含有线程的控制」· Java 代码 · 共 50 行

JAVA
50
字号
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 + =
减小字号Ctrl + -
显示快捷键?