Package ball.util.stream
Interface Combinations<T>
-
- Type Parameters:
T- TheListelement type.
- All Superinterfaces:
AutoCloseable,BaseStream<List<T>,Stream<List<T>>>,Stream<List<T>>
- All Known Subinterfaces:
Permutations<T>
public interface Combinations<T> extends Stream<List<T>>
- Author:
- Allen D. Ball
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classCombinations.SpliteratorSupplier<T>-
Nested classes/interfaces inherited from interface java.util.stream.Stream
Stream.Builder<T extends Object>
-
-
Method Summary
Static Methods Modifier and Type Method Description static <T> Stream<List<T>>of(int size0, int sizeN, Predicate<List<T>> predicate, Collection<T> collection)Method to get theStreamof combinations.static <T> Stream<List<T>>of(int size, Collection<T> collection)Method to get theStreamof combinations.-
Methods inherited from interface java.util.stream.BaseStream
close, isParallel, iterator, onClose, parallel, sequential, spliterator, unordered
-
Methods inherited from interface java.util.stream.Stream
allMatch, anyMatch, collect, collect, count, distinct, dropWhile, filter, findAny, findFirst, flatMap, flatMapToDouble, flatMapToInt, flatMapToLong, forEach, forEachOrdered, limit, map, mapToDouble, mapToInt, mapToLong, max, min, noneMatch, peek, reduce, reduce, reduce, skip, sorted, sorted, takeWhile, toArray, toArray
-
-
-
-
Method Detail
-
of
static <T> Stream<List<T>> of(int size0, int sizeN, Predicate<List<T>> predicate, Collection<T> collection)
Method to get theStreamof combinations. Combinations will be streamed largest to smallest or smallest to largest depending on the relative magnitude ofsize0andsizeN. E.g., to stream largest to smallest specifysizeNthat is greater thansize0.- Type Parameters:
T- TheCollectionelement type.- Parameters:
size0- The combination size range start (inclusive).sizeN- The combination size range end (inclusive).predicate- The optionalPredicate(may benull) specifying prerequisite requirement(s) for the combinations. Any path that does not match will be pruned.collection- TheCollectionof elements to permute.- Returns:
- The
Streamof combinations.
-
of
static <T> Stream<List<T>> of(int size, Collection<T> collection)
Method to get theStreamof combinations.- Type Parameters:
T- TheCollectionelement type.- Parameters:
size- The combination size.collection- TheCollectionof elements to permute.- Returns:
- The
Streamof combinations.
-
-