public void removeAllKey(String key) {
if(this.head.getNext() == null){
throw new RuntimeException("链表为空");
}
Node cur = this.head;
Node curNext = cur.getNext();
while(curNext != null){
if(cur.getNext().getName().equals(key)){
cur.setNext(cur.getNext().getNext());
System.out.println(">>节点 " + curNext +" 成功被删除");
curNext = curNext.getNext();
}else{
cur = cur.getNext();
curNext = curNext.getNext();
}
}
if(curNext == null){
System.out.println(">>name值等于 " + key +" 的节点不存在于链表中");
}
}