diff options
author | Josh Suereth <joshua.suereth@gmail.com> | 2012-08-08 16:30:13 -0400 |
---|---|---|
committer | Josh Suereth <joshua.suereth@gmail.com> | 2012-08-08 16:33:00 -0400 |
commit | eb2f37cbc48c499b24e2dbc34ebfd72bb7414391 (patch) | |
tree | cab3805d35f7f96b3c26f3a56e9b8707721cd90b /src/library | |
parent | ba402c457aecf7d94038534775b7b063d7d5bd9e (diff) | |
download | scala-eb2f37cbc48c499b24e2dbc34ebfd72bb7414391.tar.gz scala-eb2f37cbc48c499b24e2dbc34ebfd72bb7414391.tar.bz2 scala-eb2f37cbc48c499b24e2dbc34ebfd72bb7414391.zip |
Fix SI-6208. mutable.Queue now returns mutable.Queue for collection methods rather than MutableList.
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/collection/mutable/Queue.scala | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/library/scala/collection/mutable/Queue.scala b/src/library/scala/collection/mutable/Queue.scala index 2aa19d6cb0..21c3a84699 100644 --- a/src/library/scala/collection/mutable/Queue.scala +++ b/src/library/scala/collection/mutable/Queue.scala @@ -32,6 +32,7 @@ import generic._ */ class Queue[A] extends MutableList[A] + with LinearSeqOptimized[A, Queue[A]] with GenericTraversableTemplate[A, Queue] with Cloneable[Queue[A]] with Serializable @@ -165,6 +166,17 @@ extends MutableList[A] * @return the first element. */ def front: A = head + + + // TODO - Don't override this just for new to create appropriate type.... + override def tail: Queue[A] = { + require(nonEmpty, "tail of empty list") + val tl = new Queue[A] + tl.first0 = first0.tail + tl.last0 = last0 + tl.len = len - 1 + tl + } } |