f778c1e518
- Renamed HashMap Hashtable, because I wanted a version without ties to mx.* code. User-defined hashing functions may be specified. - Created a subclass of Hashtable called HashMap which uses functions in mx.utils.ObjectUtil to hash non-Hashable complex keys. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4120 542714f4-19e9-0310-aa3c-eee0fc999fb1
22 lines
532 B
ActionScript
22 lines
532 B
ActionScript
package com.threerings.util {
|
|
|
|
import mx.utils.ObjectUtil;
|
|
|
|
/**
|
|
* A Hashtable implementation that utilizes ObjectUtil.compare and
|
|
* ObjectUtil.toString for hashing keys that are non-simple and do
|
|
* not implement Hashable.
|
|
*/
|
|
public class HashMap extends Hashtable
|
|
{
|
|
public function HashMap (loadFactor :Number = 1.75)
|
|
{
|
|
super(loadFactor,
|
|
function (o1 :Object, o2 :Object) :Boolean {
|
|
return (0 == ObjectUtil.compare(o1, o2));
|
|
},
|
|
ObjectUtil.toString);
|
|
}
|
|
}
|
|
}
|