if(!dojo._hasResource["dojox.collections.ArrayList"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. dojo._hasResource["dojox.collections.ArrayList"] = true; dojo.provide("dojox.collections.ArrayList"); dojo.require("dojox.collections._base"); dojox.collections.ArrayList=function(/* array? */arr){ // summary // Returns a new object of type dojox.collections.ArrayList var items=[]; if(arr) items=items.concat(arr); this.count=items.length; this.add=function(/* object */obj){ // summary // Add an element to the collection. items.push(obj); this.count=items.length; }; this.addRange=function(/* array */a){ // summary // Add a range of objects to the ArrayList if(a.getIterator){ var e=a.getIterator(); while(!e.atEnd()){ this.add(e.get()); } this.count=items.length; }else{ for(var i=0; i=0) { items.splice(i,1); } this.count=items.length; }; this.removeAt=function(/* int */ i){ // summary // return an array with function applied to all elements items.splice(i,1); this.count=items.length; }; this.reverse=function(){ // summary // Reverse the internal array items.reverse(); }; this.sort=function(/* function? */ fn){ // summary // sort the internal array if(fn){ items.sort(fn); }else{ items.sort(); } }; this.setByIndex=function(/* int */ i, /* object */ obj){ // summary // Set an element in the array by the passed index. items[i]=obj; this.count=items.length; }; this.toArray=function(){ // summary // Return a new array with all of the items of the internal array concatenated. return [].concat(items); } this.toString=function(/* string */ delim){ // summary // implementation of toString, follows [].toString(); return items.join((delim||",")); }; }; }