Better optimization for getItemIndex()
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/99bf3f17 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/99bf3f17 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/99bf3f17 Branch: refs/heads/develop Commit: 99bf3f175c49a702ef011a73443a38bdb4f1eb18 Parents: 9cc57c4 Author: Harbs <[email protected]> Authored: Thu Jun 22 11:06:12 2017 +0300 Committer: Harbs <[email protected]> Committed: Thu Jun 22 11:06:12 2017 +0300 ---------------------------------------------------------------------- .../src/main/flex/org/apache/flex/collections/ArrayList.as | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/99bf3f17/frameworks/projects/Collections/src/main/flex/org/apache/flex/collections/ArrayList.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Collections/src/main/flex/org/apache/flex/collections/ArrayList.as b/frameworks/projects/Collections/src/main/flex/org/apache/flex/collections/ArrayList.as index fe74932..72a61c0 100644 --- a/frameworks/projects/Collections/src/main/flex/org/apache/flex/collections/ArrayList.as +++ b/frameworks/projects/Collections/src/main/flex/org/apache/flex/collections/ArrayList.as @@ -207,12 +207,7 @@ package org.apache.flex.collections */ public function getItemIndex(item:Object):int { - for (var index:int=0; index < _source.length; index++) { - if (item == _source[index]) { - return index; - } - } - return -1; + return _source.indexOf(item); } /**
