1

To optimize my application dictionary is a better option or arraycollection where both satisfy my needs. Please let me know. Thank you in advance.

Kishor Kumar
  • 543
  • 1
  • 12
  • 33

1 Answers1

1

Factually, arraycollection, arrays, dictionary, all act on the same internal data structure ,i.e a hashmap(or something similar). Just that an arraycollection would have some pre-initialized memory slots unlike a dictionary.

Also, arraycollections are easier to deal with incase you need to iterate or do operations like shift, unshift etc.

So the question you should be asking is, what operations do i need to do on the data, and then decide which one you need to chose.

Neeraj
  • 8,408
  • 8
  • 41
  • 69
  • Hi @Neeraj, Dictionary is satisfying all needs which are required in my application, at the same time arraycollection too. Now,I want to know to optimize my application which is the better option. – Kishor Kumar Aug 17 '11 at 10:59
  • 1
    @Kishore If your keys are always of the primitive type (i.e string, int, number etc) then you should go with an array collection not a dictionary.Incase your keys are other custom AS3 objects, then you should use a dictionary. – Neeraj Aug 17 '11 at 11:24