diff options
author | Aleksandar Prokopec <axel22@gmail.com> | 2012-05-18 19:07:06 +0200 |
---|---|---|
committer | Aleksandar Prokopec <axel22@gmail.com> | 2012-05-18 19:07:06 +0200 |
commit | f51dbd556480d42ea563623251a428b5b690571e (patch) | |
tree | 7045a17572d6be111c33b14971e9d3087139d47c /test/files | |
parent | 34fa132820ddef5d789dd6efd00dc2f3a1d27a63 (diff) | |
download | scala-f51dbd556480d42ea563623251a428b5b690571e.tar.gz scala-f51dbd556480d42ea563623251a428b5b690571e.tar.bz2 scala-f51dbd556480d42ea563623251a428b5b690571e.zip |
Fixes SI-5804.
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.
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/run/t5804.check | 4 | ||||
-rw-r--r-- | test/files/run/t5804.scala | 32 |
2 files changed, 36 insertions, 0 deletions
diff --git a/test/files/run/t5804.check b/test/files/run/t5804.check new file mode 100644 index 0000000000..3ccc1c24d3 --- /dev/null +++ b/test/files/run/t5804.check @@ -0,0 +1,4 @@ +128 +16 +128 +32
\ No newline at end of file diff --git a/test/files/run/t5804.scala b/test/files/run/t5804.scala new file mode 100644 index 0000000000..b96a736035 --- /dev/null +++ b/test/files/run/t5804.scala @@ -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) + } + } + +} |