Please, implement for all Generators:
Return -array[] or -List() of chunked Streams of precalculated (but not yet generated as output) combinations
according to input parallel thread number as a divisor for total precalculated number of output combinations, i.g.:
int n = Runtime.getRuntime().availableProcessors();
assert n == 8;
Generator.combination("red", "black", "white", "green", "blue")
.simple(3)
.asArrayOfStreamsForGivenThreads(n) //returns Stream[] or List<Stream>
.stream()
.parallel()
.forEach(e->e.forEach(System.out::println));
so, therefore user can process in parallel in chunks:
(5 streams - since it is best match for given threads divisor 10/8 == Math.ceil(5/4) == 2 (so total output 10/per 2 = 5 element-array or list) for output number of array.length or list.size() but precalculated number of total output ==10)
Please note:
It is important, that array Stream[] or List should not be prefilled by output generated data, just chunks of stream to be used for further parallel processing
In Mathmatics, there are some formulas exist for every type of combination (total output number)
Please, implement for all Generators: Return -array[] or -List() of chunked Streams of precalculated (but not yet generated as output) combinations according to input parallel thread number as a divisor for total precalculated number of output combinations, i.g.:
so, therefore user can process in parallel in chunks:
(5 streams - since it is best match for given threads divisor 10/8 == Math.ceil(5/4) == 2 (so total output 10/per 2 = 5 element-array or list) for output number of array.length or list.size() but precalculated number of total output ==10) Please note:
It is important, that array Stream[] or List should not be prefilled by output generated data, just chunks of stream to be used for further parallel processing
In Mathmatics, there are some formulas exist for every type of combination (total output number)
Thank you