@@ -26,7 +26,7 @@ import java.lang.{IndexOutOfBoundsException, IllegalArgumentException}
2626 * @define mayNotTerminateInf
2727 * @define willNotTerminateInf
2828 */
29- class ArrayBuffer [A ] private (initElems : Array [AnyRef ], initSize : Int )
29+ class ArrayBuffer [A ] private (initialElements : Array [AnyRef ], initialSize : Int )
3030 extends AbstractBuffer [A ]
3131 with IndexedSeq [A ]
3232 with IndexedSeqOps [A , ArrayBuffer , ArrayBuffer [A ]]
@@ -35,10 +35,10 @@ class ArrayBuffer[A] private (initElems: Array[AnyRef], initSize: Int)
3535
3636 def this () = this (new Array [AnyRef ](16 ), 0 )
3737
38- def this (initSize : Int ) = this (new Array [AnyRef ](initSize ), 0 )
38+ def this (initialSize : Int ) = this (new Array [AnyRef ](initialSize ), 0 )
3939
40- protected var array : Array [AnyRef ] = initElems
41- protected var size0 = initSize
40+ protected var array : Array [AnyRef ] = initialElements
41+ protected var size0 = initialSize
4242
4343 /** Ensure that the internal array has at least `n` cells. */
4444 protected def ensureSize (n : Int ): Unit =
@@ -63,9 +63,9 @@ class ArrayBuffer[A] private (initElems: Array[AnyRef], initSize: Int)
6363 array(n).asInstanceOf [A ]
6464 }
6565
66- def update (n : Int , elem : A ): Unit = {
67- checkWithinBounds(n, n + 1 )
68- array(n ) = elem.asInstanceOf [AnyRef ]
66+ def update (@ deprecatedName( ' n , " 2.13.0 " ) index : Int , elem : A ): Unit = {
67+ checkWithinBounds(index, index + 1 )
68+ array(index ) = elem.asInstanceOf [AnyRef ]
6969 }
7070
7171 def length = size0
@@ -96,55 +96,55 @@ class ArrayBuffer[A] private (initElems: Array[AnyRef], initSize: Int)
9696 this
9797 }
9898
99- def insert (idx : Int , elem : A ): Unit = {
100- checkWithinBounds(idx, idx )
99+ def insert (@ deprecatedName( ' n , " 2.13.0 " ) index : Int , elem : A ): Unit = {
100+ checkWithinBounds(index, index )
101101 ensureSize(size0 + 1 )
102- Array .copy(array, idx , array, idx + 1 , size0 - idx )
102+ Array .copy(array, index , array, index + 1 , size0 - index )
103103 size0 += 1
104- this (idx ) = elem
104+ this (index ) = elem
105105 }
106106
107107 def prepend (elem : A ): this .type = {
108108 insert(0 , elem)
109109 this
110110 }
111111
112- def insertAll (idx : Int , elems : IterableOnce [A ]): Unit = {
113- checkWithinBounds(idx, idx )
112+ def insertAll (@ deprecatedName( ' n , " 2.13.0 " ) index : Int , elems : IterableOnce [A ]): Unit = {
113+ checkWithinBounds(index, index )
114114 elems match {
115115 case elems : collection.Iterable [A ] =>
116116 val elemsLength = elems.size
117117 ensureSize(length + elemsLength)
118- Array .copy(array, idx , array, idx + elemsLength, size0 - idx )
118+ Array .copy(array, index , array, index + elemsLength, size0 - index )
119119 size0 = size0 + elemsLength
120120 elems match {
121121 case elems : ArrayBuffer [_] =>
122- Array .copy(elems.array, 0 , array, idx , elemsLength)
122+ Array .copy(elems.array, 0 , array, index , elemsLength)
123123 case _ =>
124124 var i = 0
125125 val it = elems.iterator
126126 while (i < elemsLength) {
127- this (idx + i) = it.next()
127+ this (index + i) = it.next()
128128 i += 1
129129 }
130130 }
131131 case _ =>
132- insertAll(idx , ArrayBuffer .from(elems))
132+ insertAll(index , ArrayBuffer .from(elems))
133133 }
134134 }
135135
136- def remove (idx : Int ): A = {
137- checkWithinBounds(idx, idx + 1 )
138- val res = this (idx )
139- Array .copy(array, idx + 1 , array, idx , size0 - (idx + 1 ))
136+ def remove (@ deprecatedName( ' n , " 2.13.0 " ) index : Int ): A = {
137+ checkWithinBounds(index, index + 1 )
138+ val res = this (index )
139+ Array .copy(array, index + 1 , array, index , size0 - (index + 1 ))
140140 reduceToSize(size0 - 1 )
141141 res
142142 }
143143
144- def remove (idx : Int , count : Int ): Unit =
144+ def remove (@ deprecatedName( ' n , " 2.13.0 " ) index : Int , count : Int ): Unit =
145145 if (count > 0 ) {
146- checkWithinBounds(idx, idx + count)
147- Array .copy(array, idx + count, array, idx , size0 - (idx + count))
146+ checkWithinBounds(index, index + count)
147+ Array .copy(array, index + count, array, index , size0 - (index + count))
148148 reduceToSize(size0 - count)
149149 } else if (count < 0 ) {
150150 throw new IllegalArgumentException (" removing negative number of elements: " + count)
0 commit comments