?? linqueue.java
字號(hào):
public class LinQueue implements Queue{
Node front;
Node rear;
int count;
public LinQueue(){
initiate();
}
public LinQueue(int sz){
initiate();
}
private void initiate(){
front = rear = null;
count = 0;
}
public void append(Object obj){
Node newNode = new Node(obj,null);
if(rear != null)
rear.next = newNode;
rear = newNode;
if(front == null)
front = newNode;
count ++;
}
public Object delete() throws Exception{
if(count == 0)
throw new Exception("隊(duì)列已空!");
Node temp = front;
front = front.next;
count --;
return temp.getElement();
}
public Object getFront() throws Exception{
if(count == 0)
throw new Exception("隊(duì)列已空!");
return front.getElement();
}
public boolean notEmpty(){
return count != 0;
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -