nodelist.java
来自「DATA STRUCTURE LABS」· Java 代码 · 共 33 行
JAVA
33 行
public class NodeList {
private Elem head;
public NodeList(){
head = null;
}
public void Insert(Elem a){
a.setNext(head);
head = a;
}
public Elem CheckList(String a){
Elem temp = head;
while(temp!=null){
if(temp.getName().equals(a)) return temp;
else temp = temp.getNext();
}
temp = new Elem(a);
this.Insert(temp);
return temp;
}
public String toString(){
String s="";
Elem temp = head;
while(temp!=null){
s += temp.toString();
temp = temp.getNext();
}
return s;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?