Class GenerateCombinations


  • public class GenerateCombinations
    extends Object
    A combination generator capable of generating combinations of a given array of integers.
    • Constructor Detail

      • GenerateCombinations

        public GenerateCombinations()
    • Method Detail

      • init

        public void init​(int range,
                         int[] values,
                         int setSize)
        Initialize the generator. This must be invoked before attempting to generate combinations. A generator instance can be initialized and used many times.
        Parameters:
        range - the number of input values to utilize
        values - the input values to combinatorialize
        setSize - the desired output set size
      • generateCombinations

        public void generateCombinations()
        Generate the wanted combinations according to the parameters set in the init method.
      • getResults

        public List<int[]> getResults()
        Retrieve the list of generated combinations. This list is cleared every time the init method is invoked.
        Returns:
        generated combinations