I'm new to Kotlin, and unsure how to abstract the following.
So for example I have this:
metadataOf(
"sId" to "123",
"uId" to "456"
)
where metadataOf() looks like this
fun <VALUE> metadataOf(vararg pairs: Pair<String, VALUE>) =
MetaData.from(pairs.toMap())!!
I'd like that
metadataOf(
"sId" to "123",
"uId" to "456"
)
To be standarised, so say something like metadata.message or metadataFrom(message) would produce those 2 pairs for me. (And of course in the future if I added more and I could easily do so in one place)
How would I go about writing this?
Any help appreciated.