⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stringlinkedlist.java

📁 本压缩文件中含有线程的控制
💻 JAVA
字号:
package c10;

public class StringLinkedList {
	
	private ListNode head;
	
	public StringLinkedList(){
		head = null;
	}
	
	public int length(){
		int count = 0;
		ListNode position = head;
		while(position!=null){
			count++;
			position = position.getLink();
		}
		return count;
	}
	
	public void addANodeToStart(String addData){
		head = new ListNode(addData,head);
	}
	
	public void deleteHeadNode(){
		if(head!=null){
			head = head.getLink();
		}else{
			System.out.println("empty list!");
			System.exit(0);
		}
	}
	
	public boolean onList(String target){
		return (Find(target)!=null);
	}
	
	public void showList(){
		ListNode position = head;
		while(position!=null){
			System.out.println(position.getData());
			position = position.getLink();
		}
	}
	
	private ListNode Find(String target){
		ListNode position = head;
		String data;
		while(position!=null){
			data = position.getData();
			if(data.equals(target)){
				return position;
			}
			position = position.getLink();
		}
		
		return null;
	}
	
	

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -