[chuck-users] Getting the keys for an associative array

Mike McGonagle mjmogo at gmail.com
Mon Mar 20 20:28:07 EST 2006


Is there a way to get all the keys that are used as indices into an
associative array? I was wondering if this is something that is in the
works, or is it already available? I was thinking something like...

*************

Object myAssociativeArray[0];

new Object @=> myAssociativeArray["first"];
new Object @=> myAssociativeArray["second"];

myAssociativeArray.keys => string keysList[];

for(0 => int i; i < keysList.cap(); i++) {
   <<< () => myAssociativeArray[keysList[i]].printObject >>>;
}

*************

Also, would there be a way of ensuring some sort of order inwhich the
keys are returned (ie, the order inwhich they were added to the
array???)?


Mike


More information about the chuck-users mailing list