public class CombinationEnumeration extends Object implements Enumeration<Object[]>
For example, an array { {1}, {"A", "B"}, {"X", "Y"} } provides these combinations: 1 A X 1 A Y 1 B X 1 B Y. Usage Note: Do not hold on to the returned object array as
nextElement()
returns the same array
with changed values for each enumeration.
Each array element must be non-null and length 1 or more.
Does not detect duplicates in values.
Allows any number for the first dimension.
The algorithm adds 1 to the right and overflows until done.
Constructor and Description |
---|
CombinationEnumeration(Object[][] combinations) |
Modifier and Type | Method and Description |
---|---|
static CombinationEnumeration |
fromZeroBasedRanges(int[] zeroBasedRanges) |
boolean |
hasMoreElements() |
Object[] |
nextElement() |
public CombinationEnumeration(Object[][] combinations)
public static CombinationEnumeration fromZeroBasedRanges(int[] zeroBasedRanges)
public boolean hasMoreElements()
hasMoreElements
in interface Enumeration<Object[]>
public Object[] nextElement()
nextElement
in interface Enumeration<Object[]>