Array.indexOf() turns out to be there, just not documented.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4037 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2006-04-19 21:02:38 +00:00
parent e0395bc0fc
commit 6bf2506f50
2 changed files with 1 additions and 16 deletions
-15
View File
@@ -5,21 +5,6 @@ package com.threerings.util {
*/
public class ArrayUtil
{
/**
* Return the first index of the specified element, or -1 if not present.
*/
public static function indexOf (arr :Array, element :Object) :int
{
// return mx.utils.ArrayUtil.getItemIndex(element, arr);
//
for (var ii :int = 0; ii < arr.length; ii++) {
if (arr[ii] === element) {
return ii;
}
}
return -1;
}
/**
* Remove the first instance of the specified element from the array.
*/
+1 -1
View File
@@ -28,7 +28,7 @@ public class ObserverList
*/
public function add (observer :Object) :void
{
if (ArrayUtil.indexOf(_list, observer) == -1) {
if (_list.indexOf(observer) == -1) {
_list.push(observer);
}
}