Flex Array ArrayCollection ArrayList区别

Flex Array ArrayCollection ArrayList区别

Flex Array ArrayCollection ArrayList区别

ArrayCollection实现接口ICollectionView,在Flex的类定义内属于数据集,他提供了强大的检索、过滤、排序、分类、更新监控等功能,Array在作为数据源绑定到控件上,就无法获得控件的更新,除非控件被重新绘制或者Data Provider被重新指定,在Flex4中引入了一种新的数据类型:ArrayList。他实现了IList接口,底层以Array作为数据源,本质上是一种轻量级的ArrayCollection,可以作为数据源绑定到控件上,但不能筛选和过滤数据。

简单的说:

Array更新不通知控件

ArrayList和ArrayCollection更新通知控件

ArrayCollection可以排序和过滤,ArrayList不能

 

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 Flex4 thus it will not be available in previous versions of flex sdk.

你可能感兴趣的:(Flex Array ArrayCollection ArrayList区别)