Absolutely true that same functionality can be achieved with a nested for-loop 
or a flatMap,
however for a 10+ nesting levels - or dynamic number/order of nesting levels - 
it becomes hardly manageable.

On 2024/06/26 21:02:53 Peter Burka wrote:
> 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 <al...@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
> 
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to