diff options
author | Martin Odersky <odersky@gmail.com> | 2014-01-18 17:01:00 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-01-18 17:01:00 +0100 |
commit | 558c608daad156410dc2a854d53409eea1b979a1 (patch) | |
tree | 0ddd2634ff75647a3c540f57cb48eb6815a1d940 /src/dotty/tools/dotc/util/HashSet.scala | |
parent | ed6dacc5cc241aa0e15963db5a9eeb093b6a9293 (diff) | |
download | dotty-558c608daad156410dc2a854d53409eea1b979a1.tar.gz dotty-558c608daad156410dc2a854d53409eea1b979a1.tar.bz2 dotty-558c608daad156410dc2a854d53409eea1b979a1.zip |
More tests.
Diffstat (limited to 'src/dotty/tools/dotc/util/HashSet.scala')
-rw-r--r-- | src/dotty/tools/dotc/util/HashSet.scala | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/util/HashSet.scala b/src/dotty/tools/dotc/util/HashSet.scala index 589cc1f41..8d809cdf4 100644 --- a/src/dotty/tools/dotc/util/HashSet.scala +++ b/src/dotty/tools/dotc/util/HashSet.scala @@ -21,7 +21,7 @@ class HashSet[T >: Null <: AnyRef](val label: String, initialCapacity: Int) exte def hash(x: T): Int = x.hashCode def size: Int = used - def clear() { + def clear(): Unit = { used = 0 table = new Array[AnyRef](initialCapacity) } @@ -52,7 +52,7 @@ class HashSet[T >: Null <: AnyRef](val label: String, initialCapacity: Int) exte entry.asInstanceOf[T] } - def addEntry(x: T) { + def addEntry(x: T): Unit = { var h = index(hash(x)) var entry = table(h) while (entry ne null) { @@ -64,7 +64,7 @@ class HashSet[T >: Null <: AnyRef](val label: String, initialCapacity: Int) exte used += 1 if (used > (table.length >> 2)) growTable() } - def addEntries(xs: TraversableOnce[T]) { + def addEntries(xs: TraversableOnce[T]): Unit = { xs foreach addEntry } @@ -79,7 +79,7 @@ class HashSet[T >: Null <: AnyRef](val label: String, initialCapacity: Int) exte else null } - private def addOldEntry(x: T) { + private def addOldEntry(x: T): Unit = { var h = index(hash(x)) var entry = table(h) while (entry ne null) { @@ -89,7 +89,7 @@ class HashSet[T >: Null <: AnyRef](val label: String, initialCapacity: Int) exte table(h) = x } - private def growTable() { + private def growTable(): Unit = { val oldtable = table val growthFactor = if (table.length <= initialCapacity) 8 |