So according to this discussion there is no constant time method for getting the size of a Dictionary object.
I'm trying to implement a wrapper which adds this functionality. Nothing fancy - just a 'numPairs' property and overridden methods to keep it updated. The problem lies in that the [] operator is used to add key/value pairs, rather than a named method, so I don't know how to override this to keep my counter updated. I could just do something like...
public function addPair(key:*, val:*):void {
this[key] = val;
numPairs++;
}
...but it'd be really nice if I could keep the bracket notation. Does anyone know of a solution?