Scala Library
|
|
scala/collection/immutable/Queue.scala
]
class
Queue[+A](protected val
in : List[A], protected val
out : List[A])
extends
Seq[A]Queue
objects implement data structures that allow to
insert and retrieve elements in a first-in-first-out (FIFO) manner.Method Summary | |
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.
The elements are prepended in the order they
are given out by the iterator. |
def
|
+
[B >: A](elem : B) : Queue[B]
Creates a new queue with element added at the end
of the old queue.
|
def
|
apply
(n : Int) : A
Returns the
n -th element of this queue.
The first element is at position 0. |
def
|
dequeue
: (A, Queue[A])
Returns a tuple with the first element in the queue,
and a new queue with this element removed.
|
def
|
enqueue
[B >: A](iter : Iterable[B]) : Queue[B]
Returns a new queue with all elements provided by
an
Iterable object added at the end of
the queue.
The elements are prepended in the order they
are given out by the iterator. |
def
|
enqueue
[B >: A](elem : B) : Queue[B]
Creates a new queue with element added at the end
of the old queue.
|
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
|
isEmpty
: Boolean
Checks if the queue is empty.
|
override def
|
iterator
: Iterator[A]
Returns the elements in the list as an iterator
|
def
|
length
: Int
Returns the length of the queue.
|
override def
|
toString
: java.lang.String
Returns a string representation of this queue.
|
Methods inherited from Seq | |
companion |
Methods inherited from SeqLike | |
thisCollection, toCollection, lengthCompare, size, isDefinedAt, segmentLength, prefixLength, indexWhere, indexWhere, findIndexOf, indexOf, indexOf, lastIndexOf, lastIndexOf, lastIndexWhere, lastIndexWhere, reverse, reverseMap, reverseIterator, reversedElements, startsWith, startsWith, endsWith, indexOfSeq, indexOfSeq, lastIndexOfSeq, lastIndexOfSeq, contains, union, diff, intersect, removeDuplicates, patch, updated, +:, :+, padTo, sortWith, sortWith, sortBy, toSeq, indices, view, view, hashCode, equals, findLastIndexOf, equalsWith, containsSlice, projection |
Methods inherited from PartialFunction | |
orElse, andThen |
Methods inherited from Function1 | |
compose |
Methods inherited from IterableLike | |
elements, foreach, forall, exists, find, foldRight, reduceRight, toIterable, head, take, slice, takeWhile, takeRight, dropRight, copyToArray, zip, zipAll, zipWithIndex, sameElements, toStream, canEqual, first, firstOption |
Methods inherited from GenericTraversableTemplate | |
newBuilder, genericBuilder, unzip, flatten, transpose |
Methods inherited from TraversableLike | |
repr, nonEmpty, hasDefiniteSize, ++, ++, map, flatMap, filter, filterNot, partialMap, remove, partition, groupBy, count, foldLeft, /:, :\, reduceLeft, reduceLeftOption, reduceRightOption, sum, product, min, max, headOption, tail, last, lastOption, init, drop, dropWhile, span, splitAt, copyToBuffer, copyToArray, toArray, toList, toIndexedSeq, toSet, mkString, mkString, mkString, addString, addString, addString, stringPrefix, withFilter |
Methods inherited from AnyRef | |
getClass, clone, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized |
Methods inherited from Any | |
==, !=, isInstanceOf, asInstanceOf |
Method Details |
n
-th element of this queue.
The first element is at position 0.n -
index of the element to returnn
in this queue.override
def
isEmpty : Boolean
def
length : Int
def
+[B >: A](elem : B) : Queue[B]
elem -
the element to insertelem -
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 objectIterable
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
front : A
override
def
toString : java.lang.String
Scala Library
|
|