Stellent
HowToComponents
JavaDoc

intradoc.lang
Class Queue

java.lang.Object
  |
  +--java.util.AbstractCollection
        |
        +--java.util.AbstractList
              |
              +--java.util.Vector
                    |
                    +--intradoc.lang.Queue
All Implemented Interfaces:
java.lang.Cloneable, java.util.Collection, java.util.List, java.util.RandomAccess, java.io.Serializable
Direct Known Subclasses:
BlockingQueue

public class Queue
extends java.util.Vector

The Queue class represents a first-in-first-out (FIFO) queue of objects. We model the interface for java.util.Stack although one has to wonder why it has some obvious duplications from Vector.

See Also:
intradoc.lang.QueueEmptyException, Serialized Form

Field Summary
 
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
Queue()
           
 
Method Summary
 boolean empty()
          Test if this queue is empty.
 java.lang.Object insert(java.lang.Object obj)
          Adds an object to the back of this queue.
 java.lang.Object peek()
          Peeks at the front of this queue and returns that object.
 java.lang.Object remove()
          Removes an object from the front of this queue and returns that object.
 int search(java.lang.Object obj)
          Returns where an object is in this queue (first occurrence).
 
Methods inherited from class java.util.Vector
add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, toString, trimToSize
 
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
iterator, listIterator, listIterator
 

Constructor Detail

Queue

public Queue()
Method Detail

insert

public java.lang.Object insert(java.lang.Object obj)
Adds an object to the back of this queue.

Parameters:
obj - the object to add to this queue.
Returns:
the obj argument.

remove

public java.lang.Object remove()
Removes an object from the front of this queue and returns that object.

Returns:
the object at the front of this queue.
Throws:
EmptyQueueException - if this queue is empty.

peek

public java.lang.Object peek()
Peeks at the front of this queue and returns that object.

Returns:
the object at the front of this queue.
Throws:
EmptyQueueException - if this queue is empty.

empty

public boolean empty()
Test if this queue is empty. Why does java.util.Stack implement this when the caller can use isEmpty?

Returns:
true if this queue is empty; false otherwise.

search

public int search(java.lang.Object obj)
Returns where an object is in this queue (first occurrence). Why does java.util.Stack implement this when the caller can use indexOf?

Parameters:
obj - the desired object.
Returns:
the distance from the front of the queue or -1 if not in the queue.


(c) 1996-2005  All rights reserved.  Stellent, Inc.