3 ms·
Thanks for the pointers! I find myself needing this surprisingly often: An array of elements in a certain order which I also want to lookup by Id. Sometimes
by mduerksen 12y ago
Thanks for the pointers!
I find myself needing this surprisingly often:
An array of elements in a certain order which I also want to lookup by Id.
Sometimes the order is defined by configuration, sometimes by some other criteria that is not accessible for this particular component, so I can't resort to a SortedHashMap.
Still, I need a 1) fast and 2) convenient way of lookup by some key. Convenience is often more important to me than performance in those cases, since the data size is not huge, but I hate it when I have to write array.find(e => e.Key == myKey) instead of orderedLookup[myKey].