Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have TDigest implement Consumer #212

Open
alexec opened this issue Aug 19, 2023 · 1 comment
Open

Have TDigest implement Consumer #212

alexec opened this issue Aug 19, 2023 · 1 comment

Comments

@alexec
Copy link

alexec commented Aug 19, 2023

I'm finding myself wanting to use TDigest with Java streams. I'd like to have a Collector for Digests. This would make my code simpler and more eligant.

@alexec
Copy link
Author

alexec commented Aug 19, 2023

    public static final Collector<Double, TDigest, TDigest> TDIGEST_COLLECTOR = Collector.of(
            () -> TDigest.createDigest(100),
            TDigest::add,
            ( digest1,  digest2) -> {
                digest1.add(digest2);
                return digest1;
            }
    );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant