All Packages Class Hierarchy This Package Previous Next Index
Class com.roguewave.tools.v2-0.Queue
java.lang.Object
|
+----com.roguewave.tools.v2-0.CollectionBase
|
+----com.roguewave.tools.v2-0.Slist
|
+----com.roguewave.tools.v2-0.Queue
- public class Queue
- extends Slist
- implements Cloneable, Serializable
A First-In-First-Out (FIFO) queue of objects. A Queue is a
sequential list for which all insertions are made at one end
(via put()), but all removals are made from the
other end (via get()). Duplicate entries are allowed.
Note that this class extends Slist and that you can use
inherited methods such as isEmpty() and size().
-
Queue()
-
-
clone()
- Returns a clone of this Queue.
-
get()
- Returns and removes the element from the front of the queue.
-
peek()
- Peeks at the front of the queue without removing
the element there.
-
put(Object)
- Puts an item onto the end of the queue.
-
search(Object)
- Checks to see if there is an element in the queue which
is equal to (equals()) the given item, and if so,
returns its distance from the front of the queue.
Queue
public Queue()
clone
public Object clone()
- Returns a clone of this Queue. Note that the elements
themselves are not cloned.
- Overrides:
- clone in class Slist
get
public synchronized Object get()
- Returns and removes the element from the front of the queue.
- Throws: EmptyQueueException
- If the queue is empty
peek
public synchronized Object peek()
- Peeks at the front of the queue without removing
the element there.
- Returns:
- The object at the front of the queue
- Throws: EmptyQueueException
- If the queue is empty
put
public Object put(Object item)
- Puts an item onto the end of the queue.
- Parameters:
- item - the item to added to the queue
- Returns:
- The new element
search
public int search(Object item)
- Checks to see if there is an element in the queue which
is equal to (equals()) the given item, and if so,
returns its distance from the front of the queue.
- Returns:
- The distance from the front, or -1 if no such
element is found.
All Packages Class Hierarchy This Package Previous Next Index