dpaukov / combinatoricslib3

Combinatorial objects stream generators for Java.
Apache License 2.0
177 stars 24 forks source link

Best way to determine "the rest of the sequence" generated with the `subset()` method? #7

Open axkr opened 4 years ago

axkr commented 4 years ago

What is the best way to determine "the rest of the sequence" generated with the subset() method? For example to get exactly 3 partitions out of 5 elements and filling the second partition again with a "subset of the rest" and filling last partition with the subset of elements not used in the first 2 partitions?

How to improve this snippet?

Generator.subset(1, 1, 2, 2, 3)
        .simple()
        .stream()
        .forEach(System.out::println);