In keeping with Adobe's convention, Set and Map's forEach() function takes an optional 'thisObject' param

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5502 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Tom Conkling
2008-11-04 20:21:26 +00:00
parent f17e0efd07
commit b9245e9be8
6 changed files with 11 additions and 11 deletions
+3 -3
View File
@@ -263,11 +263,11 @@ public class HashMap
}
/** @inheritDoc */
public function forEach (fn :Function) :void
public function forEach (fn :Function, thisObject :* = null) :void
{
if (_simpleData != null) {
for (var key :Object in _simpleData) {
fn(key, _simpleData[key]);
fn.call(thisObject, key, _simpleData[key]);
}
}
@@ -275,7 +275,7 @@ public class HashMap
for (var ii :int = _entries.length - 1; ii >= 0; ii--) {
for (var e :Entry = (_entries[ii] as Entry); e != null;
e = e.next) {
fn(e.getOriginalKey(), e.value);
fn.call(thisObject, e.getOriginalKey(), e.value);
}
}
}