From 6bf2506f50bf3145c1a6f14d33c00b169442739d Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Wed, 19 Apr 2006 21:02:38 +0000 Subject: [PATCH] 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 --- src/as/com/threerings/util/ArrayUtil.as | 15 --------------- src/as/com/threerings/util/ObserverList.as | 2 +- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/src/as/com/threerings/util/ArrayUtil.as b/src/as/com/threerings/util/ArrayUtil.as index a99f60d85..f7e84e2aa 100644 --- a/src/as/com/threerings/util/ArrayUtil.as +++ b/src/as/com/threerings/util/ArrayUtil.as @@ -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. */ diff --git a/src/as/com/threerings/util/ObserverList.as b/src/as/com/threerings/util/ObserverList.as index f685e507a..715338cac 100644 --- a/src/as/com/threerings/util/ObserverList.as +++ b/src/as/com/threerings/util/ObserverList.as @@ -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); } }