org.paukov.combinatorics3.Generator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of combinatoricslib3 Show documentation
Show all versions of combinatoricslib3 Show documentation
Combinatorial objects stream generators for Java.
/**
* Combinatorics Library 3
* Copyright 2009-2016 Dmytro Paukov [email protected]
*/
package org.paukov.combinatorics3;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
public class Generator {
public static CombinationGenerator combination(T... args) {
return new CombinationGenerator<>(Arrays.asList(args));
}
public static CombinationGenerator combination(Collection collection) {
return new CombinationGenerator<>(collection);
}
public static PermutationGenerator permutation(T... args) {
return new PermutationGenerator<>(Arrays.asList(args));
}
public static PermutationGenerator permutation(Collection collection) {
return new PermutationGenerator<>(collection);
}
public static SubSetGenerator subset(Collection collection) {
return new SubSetGenerator<>(collection);
}
public static SubSetGenerator subset(T... args) {
return new SubSetGenerator<>(Arrays.asList(args));
}
public static IGenerator> partition(Integer value) {
return new IntegerPartitionGenerator(value);
}
@SafeVarargs
public static IGenerator> cartesianProduct(List... args) {
return new CartesianProductGenerator<>(Arrays.asList(args));
}
}