I don't know if it's been proposed before, but I think any implementation would necessarily be inefficient. I imagine such an iterator would need to produce objects of type Pair<A,B>. This would lead to a lot of allocation and could create garbage collection pressure. The same functionality can be achieved with a nested for-loop (or flatMap()), much more efficiently.
On Wed, Jun 26, 2024, 12:27 PM Alexey Pelykh <alexey.pel...@gmail.com> wrote: > G'day to all! > > It seems there's no Iterator that would implement the same thing as > Python's itertools.product (quite literally a nested for loop) with some > Java stream() capabilities. > Is this intentional (as in, was considered and rejected) or a PR with such > CartesianProductIterator would be welcomed? > > Be well, > Alexey