[ 
https://issues.apache.org/jira/browse/NUMBERS-215?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18117067#comment-18117067
 ] 

Gilles Sadowski commented on NUMBERS-215:
-----------------------------------------

{quote}
Perhaps we should drop
{code}
public <T> Stream<List<List<T>>> stream(T... items) { /* ... */ }
{code}
{quote}

Actually, this is almost exactly my use case:
{code}
for (int k = 1; k <= 4; k++) {
    final List<List<String>> p = Stirling.S2.of(4, k).stream("A", "B", "C", "D")
        .collect(Collectors.toList());

    process(p);
}
{code}

Nevertheless, I don't mind dropping it, in order to keep the API lean.

> Stirling partitions generator
> -----------------------------
>
>                 Key: NUMBERS-215
>                 URL: https://issues.apache.org/jira/browse/NUMBERS-215
>             Project: Commons Numbers
>          Issue Type: New Feature
>          Components: combinatorics
>            Reporter: Gilles Sadowski
>            Assignee: Gilles Sadowski
>            Priority: Minor
>             Fix For: 1.4
>
>
> Would it be useful to provide functionality to *iterate* over the partitions 
> defined by "Stirling number of the second kind" (i.e. all partitions into K 
> subsets, of a set of N elements)?
> Code would be in a nested static class of the existing 
> [{{Stirling}}|https://commons.apache.org/proper/commons-numbers/commons-numbers-combinatorics/apidocs/src-html/org/apache/commons/numbers/combinatorics/Stirling.html]
>  class:
> {code}
> public final class Stirling {
>     // ...
>     public static final class S2 implements Iterable<List<List<Integer>> {
>          // ...
>          public static S2 of(int n, int k) {
>              // ...
>          }
>     }
> }
> {code}
> I have a potential use case (for very small "N").



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to