📄 queue.java
字号:
/* * Generic Queue Interface * $Id: Queue.java,v 1.1.1.1 2002/06/05 21:56:32 root Exp $ * * Developed for "Rethinking CS101", a project of Lynn Andrea Stein's AP Group. * For more information, see <a href="http://www.ai.mit.edu/projects/cs101/">the * CS101 homepage</a> or email <las@ai.mit.edu>. * * Copyright (C) 1998 Massachusetts Institute of Technology. * Please do not redistribute without obtaining permission. */package cs101.util.queue;import java.util.Enumeration;/** * Generic Queue Interface. Allows insertion/deletion at either end. * <p> * Copyright (c) 1998 Massachusetts Institute of Technology * * @author Todd C. Parnell, tparnell@ai.mit.edu * @version $Id: Queue.java,v 1.1.1.1 2002/06/05 21:56:32 root Exp $ */public interface Queue { public static final int FRONT = 0; public static final int BACK = 1; /** Returns the number of elements in this. */ public int size(); /** * Gets the tail object from the queue </B>without</B> removing * it. */ public Object peek(); /** * Gets the object from the specified end of the queue * </B>without</B> removing it. */ public Object peek(int end); /** Puts obj into the front the queue. */ public void enqueue(Object obj); /** Puts obj into the specified end of the queue. */ public void enqueue(Object obj, int end); /** Removes and returns the Object at the tail of the queue. */ public Object dequeue(); /** Removes and returns the Object at the specified end of the queue. */ public Object dequeue(int end); /** Tests whether the queue is empty. */ public boolean isEmpty (); /** Returns an Enumeration of the Objects in the queue.<p> * * <I>Note: Do not modify the queue while enumerating--unpredictable * behavior may result.</I> * * @see java.util.Enumeration */ public Enumeration elements(); }/* * $Log: Queue.java,v $ * Revision 1.1.1.1 2002/06/05 21:56:32 root * CS101 comes to Olin finally. * * Revision 1.1 2000/04/24 22:17:18 nathanw * Bulk reorganization * * Revision 1.12 1999/07/27 16:59:16 las * Updated cs101.util.Queue.java to spell its method peek() * * Revision 1.11 1999/01/21 20:49:19 tparnell * Made Queue.java an interface and added DefaultQueue.java as an implementation. * * Revision 1.10 1998/07/31 21:42:36 tparnell * bugfix * * Revision 1.9 1998/07/31 21:39:01 tparnell * added size() method * * Revision 1.8 1998/07/24 17:19:33 tparnell * Placate new javadoc behavior * */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -