Skip to content

Commit

Permalink
cypher performance
Browse files Browse the repository at this point in the history
  • Loading branch information
jexp committed May 9, 2012
1 parent 1da2945 commit c32b45b
Showing 1 changed file with 6 additions and 5 deletions.
Expand Up @@ -36,11 +36,12 @@ class NiceHasher(val original: Seq[Any]) {

override def toString = hashCode() + " : " + original.toString

private lazy val hash = original.map {
case x: Array[AnyRef] => java.util.Arrays.deepHashCode(x)
case null => 0
case x => x.hashCode()
}.foldLeft(0)((a, b) => 31 * a + b)
private lazy val hash = original.foldLeft(0) ((hashValue,element) => { element match {
case x: Array[AnyRef] => java.util.Arrays.deepHashCode(x)
case null => 0
case x => x.hashCode()
}
} + hashValue * 31 )

override def hashCode() = hash
}

0 comments on commit c32b45b

Please sign in to comment.