Do you HAVE to loop through types?

Blitz3D Forums/Blitz3D Beginners Area/Do you HAVE to loop through types?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Maps (aka associative arrays, hash tables) have O(1) complexity, which is why they are so awesome. See the Wikipedia articles on Associative Arrays, Hash Tables, and specifically the [a http://en.wikipedia.org/wiki/Talk:Hash_table#O.281.29_should_be_O.28k.29_k_being_the_key-length]talk on O(1)[/a].

GitTech's example doesn't need a new Field, you can use the After command. I wouldn't recommend this approach as it only half-solves the problem - you get multiple linked lists per type, but you have to keep track of start and end nodes, you can't have the same object in two lists, andyou have to make sure that nodes get entered into the correct "list" via Insert.

I've implemented some Container Classes which make it easy to store collections of objects using Object() and Handle(). They circumvent the drawbacks of both builtin lists and typed arrays.