Class EnumerationOfCombinations

  • All Implemented Interfaces:
    Iterator<int[]>

    public class EnumerationOfCombinations
    extends EnumerationCartesian
    This class allows us to iterate over all combinations of a given length from a given set of values. Execute the main method for an illustration.
    • Constructor Detail

      • EnumerationOfCombinations

        public EnumerationOfCombinations​(int[] nValues)
        Builds an object that can be used for enumerating combinations, using the specified numbers of values.
        Parameters:
        nValues - the number of possible different values at each position of the tuples. These numbers must be in an increasing order (and are usually all equal)
      • EnumerationOfCombinations

        public EnumerationOfCombinations​(int nValues,
                                         int tupleLength)
        Builds an object that can be used for enumerating combinations, using the specified number of values. Each tuple (combination) has the specified length.
        Parameters:
        nValues - the number of values used to form combinations
        tupleLength - the length of each combination