1  package frost.collections
 2  
 3  ====================================================================================================
 4  Provides functionality necessary for being used as a key in a [HashMap] or [HashSet]. In addition to
 5  the operators inherited from [Equatable], `Key` provides the ability to compute a hash code for an
 6  object.  A hash code is a number with the following properties:
 7  
 8  1. It is stable. Hash codes do not change during the lifetime of the object.
 9  2. If two objects compare equal, their hash codes are guaranteed to be equal.
10  3. If two objects compare unequal, their hash codes are unlikely to be equal.
11  
12  If requirements 1 or 2 are violated, the [HashMap] or [HashSet] will have undefined behavior.
13  Violating requirement 3 will not break anything, but will reduce performance.
14  ====================================================================================================
15  interface HashKey<T:Equatable<T>> : Equatable<T> {
16      ================================================================================================
17      Returns a hash code for this object. While hash codes must be stable within a single run of a
18      program, they are not, in general, guaranteed to remain stable across different runs of the same
19      program - in particular, future versions of Frost may choose to use different hashing
20      algorithms.
21      ================================================================================================
22      property hash:Int
23  
24      function get_hash():Int
25  }