summaryrefslogtreecommitdiff
path: root/src/library
diff options
context:
space:
mode:
authorPerformant Data LLC <performantdata@users.noreply.github.com>2015-10-10 00:04:09 -0700
committerPerformant Data LLC <performantdata@users.noreply.github.com>2015-10-10 00:04:09 -0700
commit30d704df5c66986b82cd3158e8e36a0f1b5284ab (patch)
treef7a85fbfc1d42432b9c29e54dea0c197f9403e9f /src/library
parent1fb32fcf04386f52e72522bd688e69edafd95414 (diff)
downloadscala-30d704df5c66986b82cd3158e8e36a0f1b5284ab.tar.gz
scala-30d704df5c66986b82cd3158e8e36a0f1b5284ab.tar.bz2
scala-30d704df5c66986b82cd3158e8e36a0f1b5284ab.zip
Document some OpenHashMap internal methods.
Diffstat (limited to 'src/library')
-rw-r--r--src/library/scala/collection/mutable/OpenHashMap.scala13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/library/scala/collection/mutable/OpenHashMap.scala b/src/library/scala/collection/mutable/OpenHashMap.scala
index 094f7eb63e..5f8f5b9a0a 100644
--- a/src/library/scala/collection/mutable/OpenHashMap.scala
+++ b/src/library/scala/collection/mutable/OpenHashMap.scala
@@ -81,6 +81,9 @@ extends AbstractMap[Key, Value]
h ^ (h >>> 7) ^ (h >>> 4)
}
+ /** Increase the size of the table.
+ * Copy only the occupied slots, effectively eliminating the deleted slots.
+ */
private[this] def growTable() = {
val oldSize = mask + 1
val newSize = 4 * oldSize
@@ -92,8 +95,18 @@ extends AbstractMap[Key, Value]
deleted = 0
}
+ /** Return the index of the first slot in the hash table (in probe order)
+ * that either is empty, or is or was last occupied by the given key.
+ */
private[this] def findIndex(key: Key) : Int = findIndex(key, hashOf(key))
+ /** Return the index of the first slot in the hash table (in probe order)
+ * that either is empty, or is or was last occupied by the given key.
+ *
+ * This method is an optimization for when the hash value is in hand.
+ *
+ * @param hash hash value for `key`
+ */
private[this] def findIndex(key: Key, hash: Int): Int = {
var j = hash