Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The hash table initialSize method is now within the the hashset and hashmap classes, and not in the companion. Overriding this method now yields hashmaps and hashsets of the proper initial capacity. Review by @phaller.
- Loading branch information
Aleksandar Prokopec
committed
May 18, 2012
1 parent
34fa132
commit f51dbd5
Showing
4 changed files
with
49 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
128 | ||
16 | ||
128 | ||
32 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
|
||
|
||
import collection.mutable._ | ||
|
||
|
||
object Test { | ||
|
||
def main(args: Array[String]) { | ||
class CustomHashMap extends HashMap[Int, Int] { | ||
override def initialSize = 65 | ||
|
||
println(table.length) | ||
} | ||
|
||
new CustomHashMap | ||
new HashMap { | ||
println(table.length) | ||
} | ||
|
||
class CustomHashSet extends HashSet[Int] { | ||
override def initialSize = 96 | ||
|
||
println(table.length) | ||
} | ||
|
||
new CustomHashSet | ||
new HashSet { | ||
println(table.length) | ||
} | ||
} | ||
|
||
} |