public class CartesianProduct<T> extends Object implements Iterable<List<T>>
| Constructor and Description |
|---|
CartesianProduct(T[]... sets)
Construct an
Iterable of all combinations of arrays, taking one
element from each array. |
| Modifier and Type | Method and Description |
|---|---|
Iterator<List<T>> |
iterator() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic CartesianProduct(T[]... sets)
Iterable of all combinations of arrays, taking one
element from each array.
For example, suppose we have two arrays:
{1, 2}
{3, 4, 5}
The possible combinations are:
{1, 3}
{1, 4}
{1, 5}
{2, 3}
{2, 4}
{2, 5}
sets - arrays of elementsCopyright © 2010-2020 NM FinTech Ltd.. All Rights Reserved.