Skip to content

Commit e45b580

Browse files
adds deprecated methods append and appendAll to Buffer
1 parent c29d83d commit e45b580

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/library/scala/collection/mutable/Buffer.scala

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,29 @@ trait Buffer[A]
1919
*/
2020
def prepend(elem: A): this.type
2121

22+
/** Appends the given elements to this buffer.
23+
*
24+
* @param elem the element to append.
25+
*/
2226
@`inline` final def append(elem: A): this.type = addOne(elem)
2327

28+
@deprecated("Use appendAll instead", "2.13.0")
29+
@`inline` final def append(elems: A*): this.type = addAll(elems)
30+
31+
/** Appends the elements contained in a iterable object to this buffer.
32+
* @param xs the iterable object containing the elements to append.
33+
*/
34+
@`inline` final def appendAll(xs: IterableOnce[A]): this.type = addAll(xs)
35+
36+
2437
/** Alias for `prepend` */
2538
@`inline` final def +=: (elem: A): this.type = prepend(elem)
2639

2740
def prependAll(elems: IterableOnce[A]): this.type = { insertAll(0, elems); this }
2841

42+
@deprecated("Use prependAll instead", "2.13.0")
43+
@`inline` final def prepend(elems: A*): this.type = prependAll(elems)
44+
2945
/** Inserts a new element at a given index into this buffer.
3046
*
3147
* @param idx the index where the new elements is inserted.

0 commit comments

Comments
 (0)