//删除所有值为key的节点
public void removeAllKey(int key){
ListNode cur = this.head;
while (cur != null) {
if (cur.val == key) {
if (cur == head) {
head = head.next;
if (head != null) {
head.prev = null;
} else {
last = null;
}
} else {
cur.prev.next = cur.next;
if (cur.next != null) {
//中间位置
cur.next.prev = cur.prev;
} else {
last = last.prev;
}
}
//return;
}
cur = cur.next;
}
}