Logo

Programming-Idioms

Create the list k containing all the keys of the map m
New implementation

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating material.

Please try to avoid dependencies to third-party libraries and frameworks.

Other implementations
final k = m.keys;
import "golang.org/x/exp/maps"
k := maps.Keys(m)
k := make([]K, 0, len(m))
for key := range m {
	k = append(k, key)
}
@k = keys %m;
k = m.keys()
k = m.keys
use std::collections::HashMap;
m.keys().collect::<Vec<_>>()