Class CombinationResolver
- java.lang.Object
-
- de.alpharogroup.lottery.combinations.CombinationResolver
-
public final class CombinationResolver extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description CombinationResolver()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.List<java.util.List<java.lang.Integer>>getAllCombinations(java.util.List<java.lang.Integer> possibleNumbers, int combinationSize)Gets all possible combinations from the given list ofIntegerobjectsstatic longgetAllPossibleCombinationsCount(int possibleNumbers, int combinationSize)Gets the count of all possible combinations from the given size of the set of possible numbers and the given size of the subset to be counted.static <T> java.util.List<java.util.List<T>>getCombinations(java.util.List<T> possibleValues, int combinationSize)Gets all possible combinations from the given list
-
-
-
Method Detail
-
getAllCombinations
public static java.util.List<java.util.List<java.lang.Integer>> getAllCombinations(java.util.List<java.lang.Integer> possibleNumbers, int combinationSize)Gets all possible combinations from the given list ofIntegerobjects- Parameters:
possibleNumbers- the possible numberscombinationSize- the size of the combination to generate- Returns:
- all possible combinations from the given list of
Integerobjects
-
getAllPossibleCombinationsCount
public static long getAllPossibleCombinationsCount(int possibleNumbers, int combinationSize)Gets the count of all possible combinations from the given size of the set of possible numbers and the given size of the subset to be counted. Note:
uses internally the method oforg.apache.commons.math3.util.CombinatoricsUtils#binomialCoefficient(int, int)- Parameters:
possibleNumbers- the size of possible numberscombinationSize- the size of a single combination- Returns:
- an exact representation of the Binomial Coefficient, "n choose k", the number of k-element subsets that can be selected from an n-element set.
-
getCombinations
public static <T> java.util.List<java.util.List<T>> getCombinations(java.util.List<T> possibleValues, int combinationSize)Gets all possible combinations from the given list- Type Parameters:
T- the generic type of the elements in the list- Parameters:
combinationSize- the size of the elements of the combinations to generatepossibleValues- the list with the element values- Returns:
- all possible combinations from the given list
-
-