Interface Queue.Queue
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Interface Queue.Queue

public interface Queue
extends Object
extends Cloneable
A queue is a container that stores a list of items. Items can be inserted and removed from the two ends of the queue only. For flexibility, the queue interface supports both FIFO behavior and LIFO behavior. The Stack class from java.util only supports LIFO behavior.
See Also:
Stack

Method Index

 o clone()
Returns a shallow copy of the queue.
 o elements()
Returns an enumeration of the elements in the queue.
 o firstElement()
Returns the first element of the queue without removing the element.
 o insertFirst(Object)
Insert the specified element into the front of the queue.
 o insertLast(Object)
Insert the specified element into the back of the queue.
 o lastElement()
Returns the last element of the queue without removing the element.
 o removeFirst()
Remove and return an element from the front of the queue.
 o removeLast()
Remove and return an element from the back of the queue.
 o size()
Returns the number of elements in the queue.

Methods

 o lastElement
  public abstract Object lastElement() throws NoSuchElementException
Returns the last element of the queue without removing the element.
Returns:
the last element
 o firstElement
  public abstract Object firstElement() throws NoSuchElementException
Returns the first element of the queue without removing the element.
Returns:
the first element
 o insertFirst
  public abstract void insertFirst(Object elem)
Insert the specified element into the front of the queue.
Parameters:
elem - element to be inserted
 o insertLast
  public abstract void insertLast(Object elem)
Insert the specified element into the back of the queue.
Parameters:
elem - element to be inserted
 o removeFirst
  public abstract Object removeFirst() throws NoSuchElementException
Remove and return an element from the front of the queue.
Returns:
the element at the front of the queue
Throws: NoSuchElementException
thrown when there are no elements in the queue
 o removeLast
  public abstract Object removeLast() throws NoSuchElementException
Remove and return an element from the back of the queue.
Returns:
the element at the back of the queue
Throws: NoSuchElementException
thrown when there are no elements in the queue
 o size
  public abstract int size()
Returns the number of elements in the queue.
 o elements
  public abstract Enumeration elements()
Returns an enumeration of the elements in the queue.
Returns:
the enumeration
See Also:
Enumeration
 o clone
  public abstract Object clone()
Returns a shallow copy of the queue.
Overrides:
clone in class Object
See Also:
clone

All Packages  Class Hierarchy  This Package  Previous  Next  Index