in scala/collection/mutable
class Queue

class Queue[A]()
extends MutableList[A]
with ScalaObject
Implementing classes or objects:
class SynchronizedQueue[A]()
trait QueueProxy[A]()

Queue objects implement data structures that allow to insert and retrieve elements in a first-in-first-out (FIFO) manner.
Author:
Matthias Zenger
Version:
1.1, 03/05/2004

Method Summary
  def ++=(iter: Iterable[A]): Unit
     Adds all elements provided by an Iterable object at the end of the queue.
  def ++=(it: Iterator[A]): Unit
     Adds all elements provided by an iterator at the end of the queue.
  def +=(elem: A): Unit
     Inserts a single element at the end of the queue.
  def clear: Unit
     Removes all elements from the queue.
override def clone(): Queue[A]
     This method clones the queue.
  def dequeue: A
     Returns the first element in the queue, and removes this element from the queue.
  def dequeueAll(p: (A) => Boolean): Seq[A]
     Returns all elements in the queue which satisfy the given predicate, and removes those elements from the queue.
  def dequeueFirst(p: (A) => Boolean): Option[A]
     Returns the first element in the queue which satisfies the given predicate, and removes this element from the queue.
  def enqueue(elems: A*): Unit
     Adds all elements to the queue.
override def equals(that: Any): Boolean
     Checks if two queues are structurally identical.
  def front: A
     Returns the first element in the queue, or throws an error if there is no element contained in the queue.
override def hashCode(): Int
     The hashCode method always yields an error, since it is not safe to use mutable queues as keys in hash tables.
  def isEmpty: Boolean
     Checks if the queue is empty.
override def toString(): String
     Returns a textual representation of a queue as a string.

Methods inherited from java/lang/Object-class
eq, finalize, getClass, ne, notify, notifyAll, synchronized, wait, wait, wait

Methods inherited from scala/Any-class
!=, ==, asInstanceOf, isInstanceOf, match

Methods inherited from scala/Iterable-class
/:, :\, concat, exists, find, foldLeft, foldRight, forall, foreach, sameElements

Methods inherited from scala/ScalaObject-class
getScalaType

Methods inherited from scala/Seq-class
concat, copyToArray, drop, indexOf, isDefinedAt, lastIndexOf, subseq, take

Methods inherited from scala/collection/mutable/MutableList-class
appendElem, apply, elements, first, get, last, len, length, prependElem, reset, stringPrefix, toList

Method Detail

isEmpty

  def isEmpty: Boolean
Checks if the queue is empty.
Returns:
true, iff there is no element in the queue.

+=

  def +=(elem: A): Unit
Inserts a single element at the end of the queue.
Parameters:
elem - the element to insert

++=

  def ++=(iter: Iterable[A]): Unit
Adds all elements provided by an Iterable object at the end of the queue. The elements are prepended in the order they are given out by the iterator.
Parameters:
iter - an iterable object

++=

  def ++=(it: Iterator[A]): Unit
Adds all elements provided by an iterator at the end of the queue. The elements are prepended in the order they are given out by the iterator.
Parameters:
it - an iterator

enqueue

  def enqueue(elems: A*): Unit
Adds all elements to the queue.
Parameters:
elems - the elements to add.

dequeue

  def dequeue: A
Returns the first element in the queue, and removes this element from the queue.
Returns:
the first element of the queue.

dequeueFirst

  def dequeueFirst(p: (A) => Boolean): Option[A]
Returns the first element in the queue which satisfies the given predicate, and removes this element from the queue.
Parameters:
p - the predicate used for choosing the first element
Returns:
the first element of the queue for which p yields true

dequeueAll

  def dequeueAll(p: (A) => Boolean): Seq[A]
Returns all elements in the queue which satisfy the given predicate, and removes those elements from the queue.
Parameters:
p - the predicate used for choosing elements
Returns:
a sequence of all elements in the queue for which p yields true.

front

  def front: A
Returns the first element in the queue, or throws an error if there is no element contained in the queue.
Returns:
the first element.

clear

  def clear: Unit
Removes all elements from the queue. After this operation is completed, the queue will be empty.

equals

  override def equals(that: Any): Boolean
Checks if two queues are structurally identical.
Returns:
true, iff both queues contain the same sequence of elements.

hashCode

  override def hashCode(): Int
The hashCode method always yields an error, since it is not safe to use mutable queues as keys in hash tables.
Returns:
never.

toString

  override def toString(): String
Returns a textual representation of a queue as a string.
Returns:
the string representation of this queue.

clone

  override def clone(): Queue[A]
This method clones the queue.
Returns:
a queue with the same elements.