Create the map m containing all the elements e of the list a, using as key the field e.id.
m = {e.id:e for e in a}
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 }
m = a.group_by(&:id)
No security, no password. Other people might choose the same nickname.