flash.utils.Dictionary.as Maven / Gradle / Ivy
package flash.utils {
/**
* The Dictionary class lets you create a dynamic collection of properties, which uses strict equality (===
) for key comparison. When an object is used as a key, the object's identity is used to look up the object, and not the value returned from calling toString()
on it.
* The following statements show the relationship between a Dictionary object and a key object:
* var dict = new Dictionary();
var obj = new Object();
var key:Object = new Object();
key.toString = function() { return "key" }
dict[key] = "Letters";
obj["key"] = "Letters";
dict[key] == "Letters"; // true
obj["key"] == "Letters"; // true
obj[key] == "Letters"; // true because key == "key" is true b/c key.toString == "key"
dict["key"] == "Letters"; // false because "key" === key is false
delete dict[key]; //removes the key
* Note: Objects of the type QName are not valid values for keys in Dictionary object instances. Using a QName data type for a key generates a Reference error.
* @see operators#strict_equality
*
*/
public dynamic class Dictionary {
/**
* Creates a new Dictionary object. To remove a key from a Dictionary object, use the delete
operator.
* @param weakKeys Instructs the Dictionary object to use "weak" references on object keys. If the only reference to an object is in the specified Dictionary object, the key is eligible for garbage collection and is removed from the table when the object is collected.
*
*/
public function Dictionary(weakKeys:Boolean = false) {
if (weakKeys) {
trace("[WARN]", "Dictionary with weakKeys not supported by Jangaroo.");
}
}
}
}