Skip to content

Commit 39b3130

Browse files
committed
Remove dead code in HashMap
1 parent 5c7b513 commit 39b3130

File tree

1 file changed

+1
-21
lines changed

1 file changed

+1
-21
lines changed

src/library/scala/collection/immutable/ChampHashMap.scala

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,6 @@ private[immutable] sealed abstract class MapNode[K, +V] extends MapNodeSource[K,
132132
def containsKey(key: K, hash: Int, shift: Int): Boolean =
133133
this.get(key, hash, shift).isDefined
134134

135-
def contains[V1 >: V](key: K, value: V1, hash: Int, shift: Int): Boolean
136-
137135
def updated[V1 >: V](key: K, value: V1, hash: Int, shift: Int): MapNodeSource[K, V1]
138136

139137
def removed[V1 >: V](key: K, hash: Int, shift: Int): MapNode[K, V1]
@@ -228,24 +226,6 @@ private class BitmapIndexedMapNode[K, +V](val dataMap: Int, val nodeMap: Int, va
228226
false
229227
}
230228

231-
override def contains[V1 >: V](key: K, value: V1, keyHash: Int, shift: Int): Boolean = {
232-
val mask = maskFrom(keyHash, shift)
233-
val bitpos = bitposFrom(mask)
234-
235-
if ((dataMap & bitpos) != 0) {
236-
val index = indexFrom(dataMap, mask, bitpos)
237-
// TODO test drive the change from == to eq here.
238-
key == this.getKey(index) && (value.asInstanceOf[AnyRef] eq this.getValue(index).asInstanceOf[AnyRef])
239-
}
240-
241-
if ((nodeMap & bitpos) != 0) {
242-
val index = indexFrom(nodeMap, mask, bitpos)
243-
return this.getNode(index).contains(key, value, keyHash, shift + BitPartitionSize)
244-
}
245-
246-
false
247-
}
248-
249229
def updated[V1 >: V](key: K, value: V1, keyHash: Int, shift: Int): MapNodeSource[K, V1] = {
250230
val mask = maskFrom(keyHash, shift)
251231
val bitpos = bitposFrom(mask)
@@ -539,7 +519,7 @@ private class HashCollisionMapNode[K, +V](val hash: Int, val content: Vector[(K,
539519
override def containsKey(key: K, hash: Int, shift: Int): Boolean =
540520
this.hash == hash && content.exists(key == _._1)
541521

542-
override def contains[V1 >: V](key: K, value: V1, hash: Int, shift: Int): Boolean =
522+
def contains[V1 >: V](key: K, value: V1, hash: Int, shift: Int): Boolean =
543523
this.hash == hash && content.exists(payload => key == payload._1 && (value.asInstanceOf[AnyRef] eq payload._2.asInstanceOf[AnyRef]))
544524

545525
def updated[V1 >: V](key: K, value: V1, hash: Int, shift: Int): MapNodeSource[K, V1] =

0 commit comments

Comments
 (0)