Standard map / associative array structure for use in flash actionscript 3?

I relate to the new flash, and I am confused by what I have to use to store and retrieve key pairs. After some googling, I found various cartographic things to choose from:

1) Use the object:

var map:Object = new Object();
map["key"] = "value";

The problem is that some basic features seem to be missing. For example, to get the size of the map, I would have to write a utility method.

2) Use the dictionary

What does this standard library class provide over a simple object? It seems silly to exist if it is functionally identical to Object.

3) Download the regular HashMap / HashTable implementation from the Internet.

I used a lot of modern languages, and this is the first time I have not been able to find a library implementation of an associative array in 5 minutes. Therefore, I would like to receive recommendations from an experienced Flash developer.

Thank!

+3
source share
2 answers

You should use any option that is necessary for a particular situation. There is no right answer to say "always use" x ".

I found that the vast majority of time- Objectbased dictionaries are all that is needed. They are extremely fast and easy to use, and I hardly need any extra features. It converts any key into a string that works well for most situations.

Dictionary , - ( Flex 1.0 alpha 1). , , - , Flex .

, . , , , Object . , , .

0

Source: https://habr.com/ru/post/1742606/


All Articles