Post
Wrote my own mapWithIndex to improve Day 4 (github.com/mvitz/advent...) but wasn't exactly sure how to write a correct flatMapWithIndex.
github.comgithub.com
To avoid the flatMap(identity) I guess you could do something akin to: gather(mapWithIndex(Pair::of)) .flatMap(p -> Arrays.stream(p.right().split(””)).gather(mapWithIndex((x, value) -> Pair.of(x, p.left()))).collect(…)
0 reposts1 like
No replies yet.