auto commit
This commit is contained in:
parent
4012e90b67
commit
1085339936
@ -302,9 +302,11 @@ public class Queue<Item> {
|
|||||||
|
|
||||||
// 出队列
|
// 出队列
|
||||||
public Item dequeue() {
|
public Item dequeue() {
|
||||||
|
if (isEmpty()) return null;
|
||||||
Node node = first;
|
Node node = first;
|
||||||
first = first.next;
|
first = first.next;
|
||||||
N--;
|
N--;
|
||||||
|
if (isEmpty()) last = null;
|
||||||
return node.item;
|
return node.item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user