FLEX 中的 ArrayCollection 与矢量对象 [英] ArrayCollection versus Vector Objects in FLEX

查看:21
本文介绍了FLEX 中的 ArrayCollection 与矢量对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能告诉我 Flex 中 ArrayCollection 和 Vector 之间的适用差异?我不确定我是否应该使用一个而不是另一个.我看到 Vector 是类型安全的,这让我感觉更好,但有缺点吗?

Can anyone tell me the applicable differences between an ArrayCollection and a Vector in flex? I'm unsure if I should be using one over the other. I saw that Vector is type safe and that makes me feel better, but are there disadvantages?

public var ac:ArrayCollection = new ArrayCollection();

对比

public var vec:Vector.<String> = new Vector.<String>();

谢谢.

推荐答案

另外,Vector 比 Array 快 3 倍左右,比 ArrayCollection 快 18 倍左右.

Additionally, Vector is about 3 times faster than Array, which is about 18 times faster than ArrayCollection.

经验法则是

  • 如果您不需要数据绑定/事件通知,请使用 Array

  • 如果数组中的所有元素都属于同一类型(并且您想要强类型),请使用 Vector.

这篇关于FLEX 中的 ArrayCollection 与矢量对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆