diff options
author | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2011-04-13 16:32:04 +0000 |
---|---|---|
committer | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2011-04-13 16:32:04 +0000 |
commit | 97b9978b85ff841e540d13a585e074252c747fba (patch) | |
tree | 084cb54717daca50becae8a1744b75cc8e22e130 /src | |
parent | 9334ad0db28f62c3e1d33d6b12e03720a76fb1eb (diff) | |
download | scala-97b9978b85ff841e540d13a585e074252c747fba.tar.gz scala-97b9978b85ff841e540d13a585e074252c747fba.tar.bz2 scala-97b9978b85ff841e540d13a585e074252c747fba.zip |
Further fixes #4405.
No review.
Diffstat (limited to 'src')
3 files changed, 24 insertions, 0 deletions
diff --git a/src/library/scala/collection/mutable/PriorityQueue.scala b/src/library/scala/collection/mutable/PriorityQueue.scala index 1f7e4e7879..8eb72fada7 100644 --- a/src/library/scala/collection/mutable/PriorityQueue.scala +++ b/src/library/scala/collection/mutable/PriorityQueue.scala @@ -163,6 +163,14 @@ class PriorityQueue[A](implicit val ord: Ordering[A]) * * @return the element with the highest priority. */ + @deprecated("Use `head` instead.") + def max: A = if (resarr.p_size0 > 1) toA(resarr.p_array(1)) else throw new NoSuchElementException("queue is empty") + + /** Returns the element with the highest priority in the queue, + * or throws an error if there is no element contained in the queue. + * + * @return the element with the highest priority. + */ override def head: A = if (resarr.p_size0 > 1) toA(resarr.p_array(1)) else throw new NoSuchElementException("queue is empty") /** Removes all elements from the queue. After this operation is completed, diff --git a/src/library/scala/collection/mutable/PriorityQueueProxy.scala b/src/library/scala/collection/mutable/PriorityQueueProxy.scala index f8330c3aac..912786359a 100644 --- a/src/library/scala/collection/mutable/PriorityQueueProxy.scala +++ b/src/library/scala/collection/mutable/PriorityQueueProxy.scala @@ -73,6 +73,14 @@ abstract class PriorityQueueProxy[A](implicit ord: Ordering[A]) extends Priority * * @return the element with the highest priority. */ + override def head: A = self.head + + /** Returns the element with the highest priority in the queue, + * or throws an error if there is no element contained in the queue. + * + * @return the element with the highest priority. + */ + @deprecated("Use `head` instead.") override def max: A = self.max /** Removes all elements from the queue. After this operation is completed, diff --git a/src/library/scala/collection/mutable/SynchronizedPriorityQueue.scala b/src/library/scala/collection/mutable/SynchronizedPriorityQueue.scala index 3295b43d7f..523f5154e0 100644 --- a/src/library/scala/collection/mutable/SynchronizedPriorityQueue.scala +++ b/src/library/scala/collection/mutable/SynchronizedPriorityQueue.scala @@ -71,6 +71,14 @@ class SynchronizedPriorityQueue[A](implicit ord: Ordering[A]) extends PriorityQu * * @return the element with the highest priority. */ + override def head: A = synchronized { super.head } + + /** Returns the element with the highest priority in the queue, + * or throws an error if there is no element contained in the queue. + * + * @return the element with the highest priority. + */ + @deprecated("Use `head` instead.") override def max: A = synchronized { super.max } /** Removes all elements from the queue. After this operation is completed, |