Logo

Programming-Idioms

# 330 Map to list
Create the list a containing all the values of the map m.

Ignore the keys of m. The order of a doesn't matter. a may contain duplicate values.
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
using System.Linq;
var a = m.Values.ToList();
a = Map.values(m)
a := make([]V, 0, len(m))
for _, v := range m {
	a = append(a, v)
}
import "golang.org/x/exp/maps"
a := maps.Values(m)
@a = values %m;
a = list(m.values())
a = m.values
use std::collections::HashMap;
let a = m.into_values().collect::<Vec<_>>();