以as中的泛型数组举一例看帮助手册优化的好处

优化后的代码

override public function addElement(e:BasicElements):void {
            var i:int = this.aElements.indexOf(e);
            //i如果等于-1说明aElements中不含有e
            if ( i< 0) {
            this.aElements.push(e);
            }else {
            this.aElements.splice(i, 1, e);
            this.aElements.push(e);
            }
            //this.aElements.push(e);
            
        }

原文地址:https://www.cnblogs.com/ilangxm/p/3386477.html