summaryrefslogtreecommitdiff
path: root/sources
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2003-08-06 09:05:19 +0000
committermichelou <michelou@epfl.ch>2003-08-06 09:05:19 +0000
commit8f8b0efb39fa3cbed7a5cb82444734d5a2281a89 (patch)
tree52607e63aac9b942c617fbb38886cda41806da2e /sources
parentd27a593dc1fb4936161651cdaa8a9207c6c661dd (diff)
downloadscala-8f8b0efb39fa3cbed7a5cb82444734d5a2281a89.tar.gz
scala-8f8b0efb39fa3cbed7a5cb82444734d5a2281a89.tar.bz2
scala-8f8b0efb39fa3cbed7a5cb82444734d5a2281a89.zip
- changed 'as' to 'asInstanceOf'
- added 'newThreshold' method (private)
Diffstat (limited to 'sources')
-rw-r--r--sources/scala/collection/mutable/HashTable.scala10
1 files changed, 7 insertions, 3 deletions
diff --git a/sources/scala/collection/mutable/HashTable.scala b/sources/scala/collection/mutable/HashTable.scala
index 34d863ceea..b79b9a2b29 100644
--- a/sources/scala/collection/mutable/HashTable.scala
+++ b/sources/scala/collection/mutable/HashTable.scala
@@ -4,9 +4,10 @@
** __\ \/ /__/ __ |/ /__/ __ | **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
-** $Id$
\* */
+// $Id$
+
package scala.collection.mutable;
@@ -39,7 +40,7 @@ abstract class HashTable[A] {
/** The initial threshold
*/
- protected val initialThreshold: Int = ((initialSize as Float) * loadFactor) as Int;
+ protected val initialThreshold: Int = newThreshold(initialSize);
/** The actual hash table.
*/
@@ -111,6 +112,9 @@ abstract class HashTable[A] {
if (n > 0) initTable(n - 1);
}
+ private def newThreshold(size: Int) =
+ (size * loadFactor).asInstanceOf[Int];
+
private def resize(newSize: Int) = {
val newTable: Array[List[Entry]] = new Array(newSize);
initTable(newSize - 1);
@@ -128,7 +132,7 @@ abstract class HashTable[A] {
}
rehash(table.length - 1);
table = newTable;
- threshold = ((newSize as Float) * loadFactor) as Int;
+ threshold = newThreshold(newSize);
}
protected def elemEquals(key1: A, key2: A): Boolean = (key1 == key2);