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.
final m = {
for (final e in a) e.id: e,
};
m := make(map[K]V, len(a))
for _, e := range a {
m[e.id] = e
}
local m={}
for _,e in ipairs(a) do
m[e.id]=e
end
foreach my $e (@a) {
$m{$e->id) = $e;
}
m = {e.id:e for e in a}
m = a.group_by(&:id)