Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add slice.BuildUniqueIndex #113

Closed
Primetalk opened this issue Dec 5, 2022 · 0 comments · Fixed by #133
Closed

Add slice.BuildUniqueIndex #113

Primetalk opened this issue Dec 5, 2022 · 0 comments · Fixed by #133
Assignees

Comments

@Primetalk
Copy link
Owner

If there is a unique key for slice elements, that key could be used to build a fast index based on map.

func BuildUniqueIndex[A any, K comparable](as []A, func (A) K) (map[K]A, err)

It may fail if the key value is not really unique.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant