A HashMap in actionscript that can use arbitrary objects as keys.

Internally, three different things may be done for storage:
- Simple keys can utilize the Dictionary class, we just use one of those
  inside the map.
- If the key implements Hashable, we can hash it.
- Otherwise, use mx.utils.ObjectUtil to generate a hash for any other key and
  also to compare the keys. Keys are then wrapped in a KeyWrapper object
  that implements Hashable. This last case will also handle null as a key.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4117 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2006-05-16 01:49:51 +00:00
parent 0224c33c45
commit c203c0e861
2 changed files with 315 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
package com.threerings.util {
public interface Hashable extends Equalable
{
/**
* Get a hashcode for this Equalable object so that it may be placed
* in a HashMap.
*/
function hashCode () :int;
}
}