HashMap -> HashObjectMap
Hashtable -> HashMap The one regularly used is now called HashMap. It can have keys of simple flash datatypes, as well as objects that implement Hashable. HashObjectMap has the ability to use nearly any object as a key, but pays a price for it and should be avoided unless you need it. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4591 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
package com.threerings.util {
|
||||
|
||||
import mx.utils.ObjectUtil;
|
||||
|
||||
/**
|
||||
* A HashMap implementation that utilizes ObjectUtil.compare and
|
||||
* ObjectUtil.toString for hashing keys that are non-simple and do
|
||||
* not implement Hashable.
|
||||
*/
|
||||
public class HashObjectMap extends HashMap
|
||||
{
|
||||
public function HashObjectMap (loadFactor :Number = 1.75)
|
||||
{
|
||||
super(loadFactor,
|
||||
function (o1 :Object, o2 :Object) :Boolean {
|
||||
return (0 == ObjectUtil.compare(o1, o2));
|
||||
},
|
||||
ObjectUtil.toString);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user