Skip to content

Commit 2513452

Browse files
committed
Use extracted computation
1 parent 6abc68f commit 2513452

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ final class HashMap[K, +V] private[immutable] (private[immutable] val rootNode:
144144
rootNode.getOrElse(key, keyUnimprovedHash, keyHash, 0, default)
145145
}
146146

147-
@`inline` private[this] def newHashMapOrThis[V1 >: V](newRootNode: BitmapIndexedMapNode[K, V1]): HashMap[K, V1] =
147+
@inline private[this] def newHashMapOrThis[V1 >: V](newRootNode: BitmapIndexedMapNode[K, V1]): HashMap[K, V1] =
148148
if (newRootNode eq rootNode) this else new HashMap(newRootNode)
149149

150150
def updated[V1 >: V](key: K, value: V1): HashMap[K, V1] = {
@@ -167,7 +167,7 @@ final class HashMap[K, +V] private[immutable] (private[immutable] val rootNode:
167167
else {
168168
val newNode = rootNode.concat(hm.rootNode, 0)
169169
if (newNode eq hm.rootNode) hm
170-
else newHashMapOrThis(rootNode.concat(hm.rootNode, 0))
170+
else newHashMapOrThis(newNode)
171171
}
172172
case hm: mutable.HashMap[K @unchecked, V @unchecked] =>
173173
val iter = hm.nodeIterator
@@ -271,7 +271,7 @@ final class HashMap[K, +V] private[immutable] (private[immutable] val rootNode:
271271
override def foreachEntry[U](f: (K, V) => U): Unit = rootNode.foreachEntry(f)
272272

273273
/** Applies a function to each key, value, and **original** hash value in this Map */
274-
@`inline` private[collection] def foreachWithHash(f: (K, V, Int) => Unit): Unit = rootNode.foreachWithHash(f)
274+
@inline private[collection] def foreachWithHash(f: (K, V, Int) => Unit): Unit = rootNode.foreachWithHash(f)
275275

276276
override def equals(that: Any): Boolean =
277277
that match {
@@ -1326,7 +1326,7 @@ private final class BitmapIndexedMapNode[K, +V](
13261326
case _ => false
13271327
}
13281328

1329-
@`inline` private def deepContentEquality(a1: Array[Any], a2: Array[Any], length: Int): Boolean = {
1329+
@inline private def deepContentEquality(a1: Array[Any], a2: Array[Any], length: Int): Boolean = {
13301330
if (a1 eq a2)
13311331
true
13321332
else {

0 commit comments

Comments
 (0)