Flex4 ArrayList vs ArrayCollection

 

http://sunnytambi.blogspot.com/2010/03/flex-4-arraylist-vs-arraycollection.html 写道
Flex 4: ArrayList vs ArrayCollection

ArrayList and ArrayCollection both can be used to store and manipulate list data. Both supports flex data binding which can drive the watching object to update itself on data change.
However the key difference between ArrayList and ArrayCollection is that ArrayCollection has additional logic to sort and filter the list data however ArrayList is created specifically to hold and manipulate data and still be bindable. Thus ArrayList is lighter version of ArrayCollection.
Note: ArrayList is added in Flex 4 thus it will not be availalble in previous versions of flex sdk.
Technorati Tags: ArrayList,ArrayCollection

 ArrayList和ArrayCollection都可以用来保存和操作列表数据。两者都支持Flex数据绑定,并且能够监听绑定对象的数据改变从而更新自己。然而ArrayList和ArrayCollection最关键的区别在于ArrayCollection附加了排序和过滤数据的逻辑,而ArrayList仅仅用于保存和操作数据还有绑定。因此ArrayList是一个轻量级的ArrayCollection。

注意:ArrayList是Flex4引入的,因此它不能在以前的Flex版本中生效。

 

翻译的很烂,凑合看吧

 

ArrayCollection中还有一些方法是ArrayList中没有的,诸如contains(ArrayList中只能用getItemIndex判断对象是否存在),ArrayCollection还能创建光标,方便对数据进行检索(当然了,检索的前提是排序)。但是很郁闷的是ArrayCollection居然没有removeItem方法(在ArrayList中提供了),删除对象之前还要先查对象的索引,好麻烦啊。。。

你可能感兴趣的:(arrayCollection)