Closed pgrisafi closed 7 years ago
Thank you very much for your suggestion. Just to be sure, you mean for mapWithIndex
to take a single BiFunction
argument:
mapWithIndex((element, index) -> doSomethingWith(element, index))
Am I right? Because that's already implemented: https://github.com/jOOQ/jOOL/pull/262.
I'm closing this as a duplicate of #262. Feel free to reopen if I misunderstood.
Agg, my bad. Thanks again
Minor enhancement: I've noted that in many cases having the index while you map is useful, specially when you need to log, or handle errors.
My pattern now is writing something like
but then, it is kind of annoying. I think it would be better to write
It is just one line of code, be it enhances readability since not everyone is familiar with zip functions, and you got to use more meaningful variable names since you are not using a tuple.
(maybe there is already a function like that and couldn't find it?)
Thanks again for this little gem!