相关代码 |
|
public class Queue { private java.util.LinkedList list = new java.util.LinkedList(); public Queue() { } public void clear() { list.clear(); } public boolean isEmpty() { return list.isEmpty(); } public T firstEl() { return list.getFirst(); } public T dequeue() { return list.removeFirst(); } public void enqueue(T el) { list.addLast(el); } public String toString() { return list.toString(); } }
相关资源 |
|