2 Replies Latest reply on Aug 16, 2007 7:35 AM by dolinja

    Flex Object equivalent to hashtable in terms of retrieval performance?

    dolinja Level 1
      Hi all,

      In many places in my Flex applications, we use an Object as we would a
      hashtable in Java or C#:

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

      var retrievedValue : String = hash["key"];
      trace(retrievedValue); // would print "value"

      In a standard hashtable implementation, retrieval from the hash is an
      O(1) constant time operation, given that you have a nicely
      distribution of hashvalues. Does the Flex Object provide this same
      functionality? Is an object really a hash of properties (ie. upon
      insertion, a hashcode is computed for the key value which is used an
      index into the storage mechanism). Or is it simply a list of
      name/value pairs stored internally, such that when retrieving a
      key/value pair, internally it iterates through the list until the key
      is found (an O(1) operation).

      Thanks so much!
      Jason