hello this probably have been asked a million of t...
# announcements
n
hello this probably have been asked a million of times how do i efficiently transform a pair into a map.entry asking for a friend 😉
😄 1
r
This sounds like an XY problem to me. It doesn't make any sense to turn them into a map entry if they aren't an entry in a map. Perhaps you need to rethink your flow...
n
the next step of my transform flow requires an entry
r
Right, that's seems like the problem. If the flow requires an entry, that assumes it's getting it's info from a map. You may need to rethink what that flow is doing, and possibly change it to use `Pair`s.
👆 1
Or you might want to look at where the pairs are coming from and see if the logic breaks down there.
If you don't have control over the next step (e.g. it's part of an external API), then what you have is probably pretty good, though I can't imaging why it needs to be internal. Sorry, I was thinking
inner
n
i’m using an external api, it requires an entry the pair i’m creating myself
internal
is because i don’t want to leak it perhaps i’m influenced by my java experience
r
Yeah, my bad. I was thinking
inner
🙂 it makes perfect sense.
n
🙂
thanks for the discussion it’s always good to question
sometimes, it’s so obvious, but not for oneself
r
Agreed. It bugs me when I come across APIs that require
Map.Entry
or similar. It usually means they were too lazy or shortsighted to think through their domain properly.
👆 2
💯 1