Package dev.nm.combinatorics
Class Twiddle<T>
- java.lang.Object
-
- dev.nm.combinatorics.Twiddle<T>
-
public class Twiddle<T> extends Object implements Iterable<Set<T>>
Generates all combinations of M elements drawn without replacement from a set of N elements. This routine may be used in two ways:- To generate all combinations of M out of N objects;
- To generate all sequences of 0's and 1's containing M 1's.
-
-
Constructor Summary
Constructors Constructor Description Twiddle(Collection<T> all, int m)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Iterator<Set<T>>
iterator()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-