📄 linqueue.java
字号:
public class LinQueue{
Link front;
Link rear;
int count;
public void LinQueue(){
initiate();
}
public void LinQueue(int sz){
initiate();
}
public void initiate(){
front = rear = null;
count = 0;
}
public void append(Object obj){
Link newNode = new Link(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("队列已空!");
Link temp = front;
front = front.next;
count --;
return temp.getElement();
}
public Object getFront() throws Exception{
if(count == 0)
throw new Exception("队列已空!");
return front.getElement();
}
public boolean isEmpty(){
return count == 0;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -