diff options
author | Martin Odersky <odersky@gmail.com> | 2010-05-21 16:04:18 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2010-05-21 16:04:18 +0000 |
commit | 90c59eb70a53e7ee0a8120ae53b4eeb711c44642 (patch) | |
tree | 15570f009cebf54c15713dedf69e0a87fd58a891 /src/library | |
parent | 1a66cb21931f53ab46d1ef21136c30dbfd6977d6 (diff) | |
download | scala-90c59eb70a53e7ee0a8120ae53b4eeb711c44642.tar.gz scala-90c59eb70a53e7ee0a8120ae53b4eeb711c44642.tar.bz2 scala-90c59eb70a53e7ee0a8120ae53b4eeb711c44642.zip |
Added +=: prepend to MutableList.
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/collection/mutable/MutableList.scala | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/library/scala/collection/mutable/MutableList.scala b/src/library/scala/collection/mutable/MutableList.scala index 81f33866ac..65c973c9ec 100644 --- a/src/library/scala/collection/mutable/MutableList.scala +++ b/src/library/scala/collection/mutable/MutableList.scala @@ -55,6 +55,13 @@ class MutableList[A] extends LinearSeq[A] tl } + /** Prepends a single element to this list. This operation takes constant + * time. + * @param elem the element to prepend. + * @return this $coll. + */ + def +=: (elem: A): this.type = { prependElem(elem); this } + /** Returns the length of this list. */ override def length: Int = len |