Skip to content

Commit

Permalink
Mark the private[collection] HashTable as not used
Browse files Browse the repository at this point in the history
  • Loading branch information
lrytz committed Nov 28, 2022
1 parent 1730e84 commit a238683
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/library/scala/collection/mutable/HashTable.scala
Expand Up @@ -35,8 +35,8 @@ import java.lang.Integer
*
* @tparam A type of the elements contained in this hash table.
*/
// Was an abstract class, but to simplify the upgrade of the parallel collections I’ve made it a trait
private[collection] /*abstract class*/ trait HashTable[A, B, Entry >: Null <: HashEntry[A, Entry]] extends HashTable.HashUtils[A] {
// Not used in the standard library, but used in scala-parallel-collections
private[collection] trait HashTable[A, B, Entry >: Null <: HashEntry[A, Entry]] extends HashTable.HashUtils[A] {
// Replacing Entry type parameter by abstract type member here allows to not expose to public
// implementation-specific entry classes such as `DefaultEntry` or `LinkedEntry`.
// However, I'm afraid it's too late now for such breaking change.
Expand Down
6 changes: 4 additions & 2 deletions src/library/scala/collection/mutable/OpenHashMap.scala
Expand Up @@ -13,8 +13,8 @@
package scala.collection
package mutable

import java.lang.Integer.numberOfLeadingZeros
import java.util.ConcurrentModificationException

import scala.collection.generic.DefaultSerializable

/**
Expand All @@ -41,6 +41,8 @@ object OpenHashMap extends MapFactory[OpenHashMap] {
final private class OpenEntry[Key, Value](var key: Key,
var hash: Int,
var value: Option[Value])

private[mutable] def nextPositivePowerOfTwo(target: Int): Int = 1 << -numberOfLeadingZeros(target - 1)
}

/** A mutable hash map based on an open addressing method. The precise scheme is
Expand Down Expand Up @@ -75,7 +77,7 @@ class OpenHashMap[Key, Value](initialSize : Int)

override def mapFactory: MapFactory[OpenHashMap] = OpenHashMap

private[this] val actualInitialSize = HashTable.nextPositivePowerOfTwo(initialSize)
private[this] val actualInitialSize = OpenHashMap.nextPositivePowerOfTwo(initialSize)

private[this] var mask = actualInitialSize - 1

Expand Down

0 comments on commit a238683

Please sign in to comment.