dr. dr. - 4 years ago 119
Scala Question

How can I use Scala's MurmurHash implementation: scala.util.MurmurHash3?

I'm writing a BloomFilter and wanted to use Scala's default MurmurHash3 implementation: scala.util.MurmurHash3. My compile is failing however with the following compile error:

[error] /mnt/hgfs/dr/sandbox/dr-commons/src/main/scala/dr/commons/collection/BloomFilter.scala:214: MurmurHash3 is not a member of scala.util
[error] import scala.util.{MurmurHash3 => MH}


I'm using Scala 2.9.1 and sbt 0.11.2.

Is the MurmurHash3 class not in the 2.9.1 library by default? I assume it is since it's used a lot in the library. The class isn't package private as far as I see.

Answer Source

It's called just scala.util.MurmurHash without the 3. But it's indeed the Murmurhash 3 algorithm (see the comments in the source)

EDIT I've just seen that Rex Kerr is the author of scala.util.MurmurHash. I would advise you not to accept this answer (assuming it's the correct one); since Rex Kerr is on StackOverflow he may chime in and give you a much better one...

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download