Skip to content

Provide methods to convert Tuple2 to Entry and Map. #597

@loggerhead

Description

@loggerhead

Suppose there are two arrays, aa and bb. I want to convert them into a map in the form of {a: b}. Currently, I need to write the code like this:

aToB := lo.FromEntries(lo.Map(lo.Zip2(aa, bb), func(kv lo.Tuple2[int64, string], _ int) lo.Entry[int64, string] {
	return lo.Entry[int64, string]{
		Key:   kv.A,
		Value: kv.B,
	}
}))

It would be much more convenient if there were a method that could directly convert lo.Tuple2 to lo.Entry.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions