Package ball.util.stream
Interface Combinations<T>
-
- Type Parameters:
T
- TheList
element 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 class
Combinations.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 theStream
of combinations.static <T> Stream<List<T>>
of(int size, Collection<T> collection)
Method to get theStream
of 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 theStream
of combinations. Combinations will be streamed largest to smallest or smallest to largest depending on the relative magnitude ofsize0
andsizeN
. E.g., to stream largest to smallest specifysizeN
that is greater thansize0
.- Type Parameters:
T
- TheCollection
element 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
- TheCollection
of elements to permute.- Returns:
- The
Stream
of combinations.
-
of
static <T> Stream<List<T>> of(int size, Collection<T> collection)
Method to get theStream
of combinations.- Type Parameters:
T
- TheCollection
element type.- Parameters:
size
- The combination size.collection
- TheCollection
of elements to permute.- Returns:
- The
Stream
of combinations.
-
-