Does flex allow empty, or missing, keys within an array collection? For example, would the following code be okay:
var myAC:ArrayCollection = new ArrayCollection;
myAC.addItemAt("hi", 0);
myAC.addItemAt("hola", 4);
myAC.addItemAt("bye", 17);
myAC.addItemAt("adios", 32);
Here's why I ask. My application is being fed an XML list full of student names. Each student has a unique ID number. These ID numbers are not always going to be sequential. I have a function where you pass in the students ID number, and you are return their name. With hundreds of students in the list, a simple for each loop that sees if the passed in ID matches the one currently being looked at while looping through the array collection is wasteful. I would like to populate the array collection and have the students ID be the key. This way, i can do the following to return the name:
return myAC.getItemAt(sID);
Is this possible? I thought it would be smarter to ask first and then try it out...