Hacker News new | past | comments | ask | show | jobs | submit login

>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.




> * 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.


> 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: