3 ms·
>So I'm curious why the insertion order is preferred, in your experience. It's a little bit like asking what's the use of a linked list. A map which can iterat
by macspoofing 5y ago
>So I'm curious why the insertion order is preferred, in your experience.
It's a little bit like asking what's the use of a linked list. A map which can iterate through keys in insertion order is just a data structure.
A recent use-case for me was using timestamps as keys that map to captured state at that time.
- recursive 5y ago> A recent use-case for me was using timestamps as keys that map to captured state at that time. That sounds like sorted key order would suffice just fine.
- chris_st 5y ago> * It's a little bit like asking what's the use of a linked list.* Well, no, it's more like asking why you'd use data structure X instead of Y. I was asking why you'd want that property as part of your data structure, and pointing out that (AFAIR) I've never needed it. For your use case, I guess you wanted to be able to retrieve the data for specific time stamps? Otherwise I'd think you'd just put it into an array.