diff options
author | Janek Bogucki <janekdb@gmail.com> | 2015-11-26 22:27:19 +0000 |
---|---|---|
committer | Janek Bogucki <janekdb@gmail.com> | 2015-11-26 22:27:19 +0000 |
commit | 9d6cdf0066716da71b3d668628a25859b353ee5e (patch) | |
tree | c5d6ca766a609ad60b5e08da5e680746d07b53d0 /src/reflect/scala/reflect/internal/util | |
parent | 2890f0b767948dd9a0953b1e669e85dbd45ec0a7 (diff) | |
download | scala-9d6cdf0066716da71b3d668628a25859b353ee5e.tar.gz scala-9d6cdf0066716da71b3d668628a25859b353ee5e.tar.bz2 scala-9d6cdf0066716da71b3d668628a25859b353ee5e.zip |
Apply some static code analysis recommendations
Fix a batch of code inspection recommendations generated by IntelliJ 14.1.5.
Categories of fix,
Unnecessary public modifier in interface
Replace filter+size with count
Replace filter+nonEmpty with exists
Replace filter+headOption with find
Replace `if (x != null) Some(x) else None` with Option(x)
Replace getOrElse null with orNull
Drop redundant semicolons
Replace anon fun with PF
Replace anon fun with method
Diffstat (limited to 'src/reflect/scala/reflect/internal/util')
-rw-r--r-- | src/reflect/scala/reflect/internal/util/WeakHashSet.scala | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/reflect/scala/reflect/internal/util/WeakHashSet.scala b/src/reflect/scala/reflect/internal/util/WeakHashSet.scala index 3a7a7626fb..83d2a3453b 100644 --- a/src/reflect/scala/reflect/internal/util/WeakHashSet.scala +++ b/src/reflect/scala/reflect/internal/util/WeakHashSet.scala @@ -41,7 +41,7 @@ final class WeakHashSet[A <: AnyRef](val initialCapacity: Int, val loadFactor: D * power of two equal to or greater than the specified initial capacity */ private def computeCapacity = { - if (initialCapacity < 0) throw new IllegalArgumentException("initial capacity cannot be less than 0"); + if (initialCapacity < 0) throw new IllegalArgumentException("initial capacity cannot be less than 0") var candidate = 1 while (candidate < initialCapacity) { candidate *= 2 @@ -372,13 +372,13 @@ final class WeakHashSet[A <: AnyRef](val initialCapacity: Int, val loadFactor: D * Number of buckets that hold collisions. Useful for diagnosing performance issues. */ def collisionBucketsCount: Int = - (table filter (entry => entry != null && entry.tail != null)).size + (table count (entry => entry != null && entry.tail != null)) /** * Number of buckets that are occupied in this hash table. */ def fullBucketsCount: Int = - (table filter (entry => entry != null)).size + (table count (entry => entry != null)) /** * Number of buckets in the table |