frost.collections

Interface HashKey<T:Equatable<T>>

Implemented Interfaces:

Provides functionality necessary for being used as a key in a HashMap or HashSet. In addition to the operators inherited from Equatable, Key provides the ability to compute a hash code for an object. A hash code is a number with the following properties:

  1. It is stable. Hash codes do not change during the lifetime of the object.
  2. If two objects compare equal, their hash codes are guaranteed to be equal.
  3. If two objects compare unequal, their hash codes are unlikely to be equal.

If requirements 1 or 2 are violated, the HashMap or HashSet will have undefined behavior. Violating requirement 3 will not break anything, but will reduce performance.

Source Code:
View Source

Field Summary

hash:Int
Returns a hash code for this object.
Inherited Fields:
Inherited Methods:

Fields

property hash:Int

Returns a hash code for this object. While hash codes must be stable within a single run of a program, they are not, in general, guaranteed to remain stable across different runs of the same program - in particular, future versions of Frost may choose to use different hashing algorithms.