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 +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" }
+
var dict = new Dictionary<Any, Any>();
+var obj:Any = {};
+var key:Any = {
+	toString: function() {
+		return "key";
+	}
+};
 
 dict[key] = "Letters";
-obj["key"] = "Letters";
+Reflect.setField(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

Static methods

staticinlineeach(this:IMap<K, V>):Iterator<V>

Returns an Iterator over each of the values of this Dictionary.

+trace(dict[key] == "Letters"); // true +trace(Reflect.field(obj, "key") == "Letters"); // true +trace(Reflect.field(obj, Std.string(key)) == "Letters"); // true because key == "key" is true b/c key.toString == "key" +trace(dict["key"] == "Letters"); // false because "key" === key is false +dict.remove(key); // removes the key +trace(dict[key] == null); // true

Static methods

staticinlineeach(this:IMap<K, V>):Iterator<V>

Returns an Iterator over each of the values of this Dictionary.

The order of values is undefined.

staticinlineexists(this:IMap<K, V>, key:K):Bool

Returns true if key has a mapping, false otherwise.

If key is null, the result is unspecified.

@:arrayAccessstaticinlineget(this:IMap<K, V>, key:K):V

Returns the current mapping of key.

If no such mapping exists, null is returned.

diff --git a/openfl/utils/index.html b/openfl/utils/index.html index 91d8d45..3cd12b6 100644 --- a/openfl/utils/index.html +++ b/openfl/utils/index.html @@ -62,11 +62,9 @@ compress and uncompress options. These constants are used as values of the algorithm parameter of the ByteArray.compress() and ByteArray.uncompress() methods.

Dictionary

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:

Endian

The Endian class contains values that denote the byte order used to +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.

Endian

The Endian class contains values that denote the byte order used to represent multibyte numbers. The byte order is either bigEndian (most significant byte first) or littleEndian (least significant byte first).

Function

Future

IAssetCache

The IAssetCache interface provides methods for caching resources loaded from openfl.utils.Assets to improve