What am I not getting with maps?

Monkey Forums/Monkey Programming/What am I not getting with maps?

Warpy(Posted 2011) [#1]
Why do IntMap and FloatMap map numbers to objects? Wouldn't you want to do it the other way round most of the time?


Tibit(Posted 2011) [#2]
I'm not sure how it is intended, but the way I use it is that I often map ID's to Objects, most times using human-readable string IDs, but ints are useful and more efficient for non-human interaction things.

If I have the class, and instead want it's ID, then I think most times I end up adding that ID to that class or it's base class as a field.

Most of the time I'm not using it the other way around, but I'm in no way saying this is normal, I have no idea what other programmers usually do :)


Warpy(Posted 2011) [#3]
That's fine for ints, but I really can't think when you'd want to map from floats to objects.


Warpy(Posted 2011) [#4]
While we're at it: for a convenience class, Set is an enormous faff to use.