Am I reading this correctly? The standard library has no built in function to get a slice of keys from a map? You need to iterate every single time and build up an extra list??

Well i don't get it.

Get a list of keys from a map to iterate the keys-list instead of the map, doubles the mem and doubles the work.. I never had the case to need the list of keys of a map 🤔 without do something in a iterative way with it.

Do you have an example for this case ?

If this is a java-thing, then better use java 😆

@martinsstar in this case I am passing in an object with a dynamic set of fields to use in a query and I just need the set of keys to compare against other sets within database indexes.

is it faster to do a map loop each time instead of having this slice? I assumed it's more overhead to iterate the entire map instead of an array of keys. Honestly I just want a high level Set type to do unions and diffs.

Sign in to participate in the conversation
Mauvestodon

Escape ship from centralized social media run by Mauve.