package queue; import array.Array; /** * @Title: ArrayQueue * @ProjectName demo */ public class ArrayQueue<E> implements Queue<E> { private Array<E> data; @Override public int getSize() { return data.getSize(); } @Override public boolean isEmpty() { return data.isEmpty(); } /** * 入队 * @param e */ @Override public void enqueue(E e) { data.addLast(e); } /** * 出队 * @return */ @Override public E dequeue() { return data.removeFirst(); } @Override public E getFront() { return data.get(0); } }