|
Scala
1.2.0.1 |
|||
Queue
objects implement data structures that allow to
insert and retrieve elements in a first-in-first-out (FIFO) manner.
Field Summary | |
protected
|
val in: List[A]
|
protected
|
val out: List[A]
|
Method Summary | |
def +[B >: A](elem: B): Queue[B]
Creates a new queue with element added at the end of the old queue. |
|
def +[B >: A](iter: Iterable[B]): Queue[B]
Returns a new queue with all all elements provided by an Iterable object added at the end of
the queue.
|
|
def apply(n: Int): A
Returns the n -th element of this queue.
|
|
def dequeue: Tuple2[A,Queue[A]]
Returns a tuple with the first element in the queue, and a new queue with this element removed. |
|
def elements: Iterator[A]
Returns the elements in the list as an iterator |
|
def enqueue[B >: A](elems: B*): Queue[B]
Returns a new queue with all elements added. |
|
override
|
def equals(o: Any): Boolean
Compares two queues for equality by comparing each element in the queues. |
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
|
def isEmpty: Boolean
Checks if the queue is empty. |
|
protected
|
def itToList[B >: A](elems: Iterator[B]): List[B]
|
def length: Int
Returns the length of the queue. |
|
protected
|
def mkQueue[A](i: List[A], o: List[A]): Queue[A]
|
def mkString(start: String, sep: String, end: String): String
Returns a string representation of this queue. |
|
override
|
def toString(): String
Returns a string representation of this queue. |
Methods inherited from java/lang/Object-class |
clone, eq, finalize, getClass, notify, notifyAll, synchronized, wait, wait, wait |
Methods inherited from scala/Any-class |
!=, ==, asInstanceOf, isInstanceOf, match |
Methods inherited from scala/Iterable-class |
/:, :\, exists, find, foldLeft, foldRight, forall, foreach, sameElements |
Methods inherited from scala/Seq-class |
copyToArray, drop, indexOf, isDefinedAt, lastIndexOf, stringPrefix, subseq, take, toList |
Field Detail |
protected val in: List[A]
protected val out: List[A]
Method Detail |
protected def itToList[B >: A](elems: Iterator[B]): List[B]
protected def mkQueue[A](i: List[A], o: List[A]): Queue[A]
def apply(n: Int): A
n
-th element of this queue.
The first element is at position 0.
n
-
index of the element to return
n
in this list.def elements: Iterator[A]
def isEmpty: Boolean
def length: Int
def +[B >: A](elem: B): Queue[B]
elem
-
the element to insert
def +[B >: A](iter: Iterable[B]): Queue[B]
Iterable
object added at the end of
the queue.
The elements are prepended in the order they
are given out by the iterator.
iter
-
an iterable object
def enqueue[B >: A](elems: B*): Queue[B]
elems
-
the elements to add.
def dequeue: Tuple2[A,Queue[A]]
def front: A
def mkString(start: String, sep: String, end: String): String
start
and is finished by the string
end
. Inside, the string representations of elements (w.r.t.
the method toString()
) are separated by the string
sep
.
Ex: Queue(1, 2, 3).mkString("(", "; ", ")") = "(1; 2; 3)"
start
-
starting string.
sep
-
separator string.
end
-
ending string.
override def toString(): String
override def equals(o: Any): Boolean
override def hashCode(): Int
|
Scala
1.2.0.1 |
|||