scala

trait Unhashable

[source: scala/Unhashable.scala]

trait Unhashable
extends AnyRef

A marker trait for data structures that cannot be hashed, for instance because they are mutable and at the same time support structural equality, so hashing them would lead to unpredictable results.

Such data structures have hashCode throw an java.lang.UnsupportedOperationException. They retain the original object hashcode with identityHashCode.

Author
Martin Odersky
Version
1.0
Direct Known Subclasses:
Map, Sequence, Set

Method Summary
override def hashCode : Int
The hashCode method always yields an error, since it is not safe to use sets as keys in hash tables.
def identityHashCode : Int
The identity hash code is the original hash code inherited from Object.
Methods inherited from AnyRef
getClass, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Method Details
override def hashCode : Int
The hashCode method always yields an error, since it is not safe to use sets as keys in hash tables.
Returns
never.

def identityHashCode : Int
The identity hash code is the original hash code inherited from Object.