Why not use a majority of sorts necessary in a program inside a HashMap?

10 days ago by pool's kitten πŸ‡§πŸ‡·πŸ΄β€β˜ οΈπŸ‡ΈπŸ‡΄ to c/ask_experienced_devs

I'm asking because inside a hashmap each element would have a signature, then it's easier to compare, no? #question

sukhmel 4 points 10 days ago

I'm not sure I understand you, but the signature will most often have a separate ordering that won't help with ordering the objects themselves.

Also, there are TreeMaps, that maintain order of elements, but those do the work on every insert

path: 0 26197802, hotness: undefined, score: 4, children: 0
ask_experienced_devs
ask_experienced_devs

@programming.dev

login for more options
1517
63
9

Icon base by Delapouite under CC BY 3.0 with modifications to add a gradient

go to feed...