MyGDQueue.java
Select all
import java.util.*; public class MyGDQueue
{ private Vector
v; public MyGDQueue() { v = new Vector
(); } public void clear() { v.clear(); } public void add(T n) { v.addElement(n); } public T remove() { return v.remove(0); } public void addBack(T n) { add(n); } public T removeFront() { return remove(); } public void addFront(T n) { v.add(0, n); } public T removeBack() { return v.remove(v.size()-1); } public boolean isEmpty() { return v.isEmpty(); } }