Skip to content

Commit df22335

Browse files
authored
Merge pull request scala/scala#10532 from rs017991/patch-1
Corrected Docs of `Map.updatedWith`
2 parents 8c1c858 + 123f3db commit df22335

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

library/src/scala/collection/concurrent/Map.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ trait Map[K, V] extends scala.collection.mutable.Map[K, V] {
140140
private[collection] def replaceRefEq(k: K, oldValue: V, newValue: V): Boolean = replace(k, oldValue, newValue)
141141

142142
/**
143-
* Update a mapping for the specified key and its current optionally-mapped value
143+
* Update a mapping for the specified key and its current optionally mapped value
144144
* (`Some` if there is current mapping, `None` if not).
145145
*
146146
* If the remapping function returns `Some(v)`, the mapping is updated with the new value `v`.
@@ -150,7 +150,7 @@ trait Map[K, V] extends scala.collection.mutable.Map[K, V] {
150150
* If the map is updated by another concurrent access, the remapping function will be retried until successfully updated.
151151
*
152152
* @param key the key value
153-
* @param remappingFunction a partial function that receives current optionally-mapped value and return a new mapping
153+
* @param remappingFunction a function that receives current optionally mapped value and return a new mapping
154154
* @return the new value associated with the specified key
155155
*/
156156
override def updateWith(key: K)(remappingFunction: Option[V] => Option[V]): Option[V] = updateWithAux(key)(remappingFunction)

library/src/scala/collection/immutable/HashMap.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2228,7 +2228,7 @@ private[immutable] final class HashMapBuilder[K, V] extends ReusableBuilder[(K,
22282228

22292229
private def isAliased: Boolean = aliased != null
22302230

2231-
/** The root node of the partially build hashmap */
2231+
/** The root node of the partially built hashmap. */
22322232
private var rootNode: BitmapIndexedMapNode[K, V] = newEmptyRootNode
22332233

22342234
private[immutable] def getOrElse[V0 >: V](key: K, value: V0): V0 =

library/src/scala/collection/immutable/HashSet.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1970,7 +1970,7 @@ private[collection] final class HashSetBuilder[A] extends ReusableBuilder[A, Has
19701970

19711971
private def isAliased: Boolean = aliased != null
19721972

1973-
/** The root node of the partially build hashmap */
1973+
/** The root node of the partially built hashmap. */
19741974
private var rootNode: BitmapIndexedSetNode[A] = newEmptyRootNode
19751975

19761976
/** Inserts element `elem` into array `as` at index `ix`, shifting right the trailing elems */

library/src/scala/collection/immutable/Map.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,15 @@ trait MapOps[K, +V, +CC[X, +Y] <: MapOps[X, Y, CC, _], +C <: MapOps[K, V, CC, C]
101101
def updated[V1 >: V](key: K, value: V1): CC[K, V1]
102102

103103
/**
104-
* Update a mapping for the specified key and its current optionally-mapped value
104+
* Update a mapping for the specified key and its current optionally mapped value
105105
* (`Some` if there is current mapping, `None` if not).
106106
*
107107
* If the remapping function returns `Some(v)`, the mapping is updated with the new value `v`.
108108
* If the remapping function returns `None`, the mapping is removed (or remains absent if initially absent).
109109
* If the function itself throws an exception, the exception is rethrown, and the current mapping is left unchanged.
110110
*
111111
* @param key the key value
112-
* @param remappingFunction a partial function that receives current optionally-mapped value and return a new mapping
112+
* @param remappingFunction a function that receives current optionally mapped value and return a new mapping
113113
* @return A new map with the updated mapping with the key
114114
*/
115115
def updatedWith[V1 >: V](key: K)(remappingFunction: Option[V] => Option[V1]): CC[K,V1] = {

library/src/scala/collection/mutable/Map.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,15 @@ trait MapOps[K, V, +CC[X, Y] <: MapOps[X, Y, CC, _], +C <: MapOps[K, V, CC, C]]
104104
def update(key: K, value: V): Unit = { coll += ((key, value)) }
105105

106106
/**
107-
* Update a mapping for the specified key and its current optionally-mapped value
107+
* Update a mapping for the specified key and its current optionally mapped value
108108
* (`Some` if there is current mapping, `None` if not).
109109
*
110110
* If the remapping function returns `Some(v)`, the mapping is updated with the new value `v`.
111111
* If the remapping function returns `None`, the mapping is removed (or remains absent if initially absent).
112112
* If the function itself throws an exception, the exception is rethrown, and the current mapping is left unchanged.
113113
*
114114
* @param key the key value
115-
* @param remappingFunction a partial function that receives current optionally-mapped value and return a new mapping
115+
* @param remappingFunction a function that receives current optionally mapped value and return a new mapping
116116
* @return the new value associated with the specified key
117117
*/
118118
def updateWith(key: K)(remappingFunction: Option[V] => Option[V]): Option[V] = {

0 commit comments

Comments
 (0)