queue.java

来自「cwbbs 云网论坛源码」· Java 代码 · 共 40 行

JAVA
40
字号
package com.cloudwebsoft.framework.util;public class Queue extends java.util.Vector {    public Queue() {        super();    }    public synchronized void enq(Object x) {        super.addElement(x);    }    public synchronized Object deq() {                if (this.empty())            throw new RuntimeException("Queue is Empty.");        Object x = super.elementAt(0);        super.removeElementAt(0);        return x;    }    public synchronized Object front() {        if (this.empty())            throw new RuntimeException("Queue is Empty.");        return super.elementAt(0);    }    public boolean empty() {        return super.isEmpty();    }    public synchronized void clear() {        super.removeAllElements();    }    public int search(Object x) {        return super.indexOf(x);    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?