Skip to content

Commit e359147

Browse files
authored
Merge pull request scala/scala#6719 from szeiger/issue/10828
Deprecate symbolic methods with multiple parameters
2 parents 63a6e37 + 58b44cf commit e359147

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

library/src/scala/collection/mutable/AnyRefMap.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,9 +285,12 @@ class AnyRefMap[K <: AnyRef, V] private[collection] (defaultEntry: K => V, initi
285285
}
286286

287287
/** Adds a new key/value pair to this map and returns the map. */
288-
def addOne(key: K, value: V): this.type = { update(key, value); this }
288+
def +=(key: K, value: V): this.type = { update(key, value); this }
289289

290-
def addOne(kv: (K, V)): this.type = { update(kv._1, kv._2); this }
290+
/** Adds a new key/value pair to this map and returns the map. */
291+
@inline final def addOne(key: K, value: V): this.type = { update(key, value); this }
292+
293+
@inline override final def addOne(kv: (K, V)): this.type = { update(kv._1, kv._2); this }
291294

292295
def subtractOne(key: K): this.type = {
293296
val i = seekEntry(hashOf(key), key)

library/src/scala/collection/mutable/Growable.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ trait Growable[-A] extends Clearable {
3636
* @param elems the remaining elements to $add.
3737
* @return the $coll itself
3838
*/
39+
@deprecated("Use `++=` (addAll) instead of varargs `+=`", "2.13.0")
3940
@`inline` final def += (elem1: A, elem2: A, elems: A*): this.type = this += elem1 += elem2 ++= (elems: IterableOnce[A])
4041

4142
/** ${Add}s all elements produced by an IterableOnce to this $coll.

library/src/scala/collection/mutable/LongMap.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,10 @@ final class LongMap[V] private[collection] (defaultEntry: Long => V, initialBuff
342342
/** Adds a new key/value pair to this map and returns the map. */
343343
def +=(key: Long, value: V): this.type = { update(key, value); this }
344344

345-
override def addOne(kv: (Long, V)): this.type = { update(kv._1, kv._2); this }
345+
/** Adds a new key/value pair to this map and returns the map. */
346+
@inline final def addOne(key: Long, value: V): this.type = { update(key, value); this }
347+
348+
@inline override final def addOne(kv: (Long, V)): this.type = { update(kv._1, kv._2); this }
346349

347350
def subtractOne(key: Long): this.type = {
348351
if (key == -key) {

0 commit comments

Comments
 (0)