diff options
author | Martin Odersky <odersky@gmail.com> | 2007-01-03 15:56:13 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2007-01-03 15:56:13 +0000 |
commit | a961d3dcd6f93ee006cff1d386052bf62326739a (patch) | |
tree | 5af3312932236340708522dfd078f32beed20519 /src/library/scala/collection/mutable/PriorityQueue.scala | |
parent | 02a45e20bb6f68808708dca377bc72ccaf5bba3d (diff) | |
download | scala-a961d3dcd6f93ee006cff1d386052bf62326739a.tar.gz scala-a961d3dcd6f93ee006cff1d386052bf62326739a.tar.bz2 scala-a961d3dcd6f93ee006cff1d386052bf62326739a.zip |
1.
Diffstat (limited to 'src/library/scala/collection/mutable/PriorityQueue.scala')
-rw-r--r-- | src/library/scala/collection/mutable/PriorityQueue.scala | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/library/scala/collection/mutable/PriorityQueue.scala b/src/library/scala/collection/mutable/PriorityQueue.scala index 8950a9fa0f..866348af1a 100644 --- a/src/library/scala/collection/mutable/PriorityQueue.scala +++ b/src/library/scala/collection/mutable/PriorityQueue.scala @@ -69,6 +69,17 @@ class PriorityQueue[A <% Ordered[A]] extends ResizableArray[A] { size = size + 1 } + def +(elem: A): PriorityQueue[A] = { this += elem; this } + + /** Add two or more elements to this set. + * @param elem1 the first element. + * @param kv2 the second element. + * @param kvs the remaining elements. + */ + def += (elem1: A, elem2: A, elems: A*) { this += elem1; this += elem2; this ++= elems } + + def + (elem1: A, elem2: A, elems: A*) = { this.+=(elem1, elem2, elems: _*); this } + /** Adds all elements provided by an <code>Iterable</code> object * into the priority queue. * @@ -82,6 +93,10 @@ class PriorityQueue[A <% Ordered[A]] extends ResizableArray[A] { */ def ++=(it: Iterator[A]): Unit = it foreach { e => this += e } + def ++(iter: Iterable[A]): PriorityQueue[A] = { this ++= iter; this } + + def ++(iter: Iterator[A]): PriorityQueue[A] = { this ++= iter; this } + /** Adds all elements to the queue. * * @param elems the elements to add. |