summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAleksandar Pokopec <aleksandar.prokopec@epfl.ch>2011-04-13 16:32:04 +0000
committerAleksandar Pokopec <aleksandar.prokopec@epfl.ch>2011-04-13 16:32:04 +0000
commit97b9978b85ff841e540d13a585e074252c747fba (patch)
tree084cb54717daca50becae8a1744b75cc8e22e130 /src
parent9334ad0db28f62c3e1d33d6b12e03720a76fb1eb (diff)
downloadscala-97b9978b85ff841e540d13a585e074252c747fba.tar.gz
scala-97b9978b85ff841e540d13a585e074252c747fba.tar.bz2
scala-97b9978b85ff841e540d13a585e074252c747fba.zip
Further fixes #4405.
No review.
Diffstat (limited to 'src')
-rw-r--r--src/library/scala/collection/mutable/PriorityQueue.scala8
-rw-r--r--src/library/scala/collection/mutable/PriorityQueueProxy.scala8
-rw-r--r--src/library/scala/collection/mutable/SynchronizedPriorityQueue.scala8
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,