Description
Order matters for these two collection types, and the collection clearly knows the indexing internally in the _list
member (I know, implementation detail, but it would have to know somehow either way), so it is very unfortunate that you can't really treat interface with the indexes in many meaningful ways. To list two instances that I frequently run into this problem:
-
Would of course be nice to just be able to do
orderedMap.at(index)
. This is my main gripe right now, the fact that I need to store out an almost identical separate collection that's just a List to be able to go to index -> item. -
Would be nice to have
index
show up in things likemap
andreduce
(filter
, etc.). Given that the API for.map
is already(item, key, collection)
, perhaps we could do(item, key, collection, index)
to not have any backwards-incompatible changes.