Thursday, March 12, 2009

QUEUES

  • is a particular kind of collection in which the entities in the collection are kept in order and the principal (or only) operations on the collection are the addition of entities to the rear terminal position and removal of entities from the front terminal position.
  • First-In-First-Out (FIFO) data structure,the first element added to the queue will be the first one to be removed.
  • an example of a linear data structure
  • are common in computer programs, where they are implemented as data structures coupled with access routines, as an abstract data structure or in object-oriented languages as classes
  • are dynamic collections which have some concept of order

Method Summary
boolean add(E e)
Inserts the specified element into this queue if it is possible to do so immediately without violating capacity restrictions, returning true upon success and throwing an IllegalStateException if no space is currently available.
E element()
Retrieves, but does not remove, the head of this queue.
boolean offer(E e)
Inserts the specified element into this queue if it is possible to do so immediately without violating capacity restrictions.
E peek()
Retrieves, but does not remove, the head of this queue, or returns null if this queue is empty.
E poll()
Retrieves and removes the head of this queue, or returns null if this queue is empty.
E remove()
Retrieves and removes the head of this queue.




references:
http://en.wikipedia.org/wiki/Queue_(data_structure)
http://www.cs.auckland.ac.nz/software/AlgAnim/queues.html
http://java.sun.com/javase/6/docs/api/java/util/Queue.html

No comments:

Post a Comment