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:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user