diff options
author | Martin Odersky <odersky@gmail.com> | 2008-08-15 16:27:10 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2008-08-15 16:27:10 +0000 |
commit | 20a3e4ee457e61d3f695b794260b5a1e1e0156e9 (patch) | |
tree | 4a202ce58be5e09fa27881462d30dffba7fcf47c /src/library/scala/collection/mutable/Buffer.scala | |
parent | d82034554088b25d30ae9dcdae5146b5351e7fc5 (diff) | |
download | scala-20a3e4ee457e61d3f695b794260b5a1e1e0156e9.tar.gz scala-20a3e4ee457e61d3f695b794260b5a1e1e0156e9.tar.bz2 scala-20a3e4ee457e61d3f695b794260b5a1e1e0156e9.zip |
Buffer gets vararg +, += methods; small fixes.
Diffstat (limited to 'src/library/scala/collection/mutable/Buffer.scala')
-rw-r--r-- | src/library/scala/collection/mutable/Buffer.scala | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/library/scala/collection/mutable/Buffer.scala b/src/library/scala/collection/mutable/Buffer.scala index 9d35ab0bed..cbe594bca1 100644 --- a/src/library/scala/collection/mutable/Buffer.scala +++ b/src/library/scala/collection/mutable/Buffer.scala @@ -35,6 +35,18 @@ trait Buffer[A] extends AnyRef */ def +=(elem: A): Unit + /** Append a two or more elements to this buffer. + * + * @param elem1 the first element to append. + * @param elem2 the second element to append. + * @param elems the remaining elements to append. + */ + def +=(elem1: A, elem2: A, elems: A*): Unit = { + this += elem1 + this += elem2 + this ++= elems + } + /** Append a single element to this buffer and return * the identity of the buffer. * @@ -42,6 +54,16 @@ trait Buffer[A] extends AnyRef */ def +(elem: A): Buffer[A] = { this += elem; this } + /** Append two or more elements to this buffer and return + * the identity of the buffer. + * + * @param elem1 the first element to append. + * @param elem2 the second element to append. + * @param elems the remaining elements to append. + */ + def +(elem1: A, elem2: A, elems: A*): Buffer[A] = + this + elem1 + elem2 ++ elems + /** Prepend a single element to this buffer and return * the identity of the buffer. * |