Noob seeks to emulate javascript array
anyone have any suggestions for emulating this behavior described below?
I need a way to have an indexed list, which will store undefined indexes. Hashtable<Integer,blah> could do it, but the thing is that the integers are unordered. they aren't indexes.
The other way to describe it is an array of parking spaces, where the space can either be empty or have a car object in it. I'd also like to be able to reliably iterate from one end of the block to the other.
in code, I'd like to be able to do the following
JSArray<Car> parkingSpaces =new JSArray<Car>();
parkingSpaces.set(0,new Car("maybach") );
parkingSpaces.set(1,new Car("beemer") );
parkingSpaces.set(2,new Car("broken down gremlin") );
myWeirdCollection.remove(1);
for(int i = 0 ; i< myWeirdCollection.size();i++)
{
if(myWeirdCollection.get(i)==null)
{
println(i+" empty parking space!");
}
else
{
print(i+" "+myWeirdCollection.get(i) );
}
}
/*
output:
0 maybach
1 empty parking space!
2 broken down gremlin
*/
please forgive me if this has been covered. I'm having a tough time making my way around this huge library of documentation. I think I explored all the built in collections though. I'm still trying to think of a way to maybe subclass a hashtable or something.

