Replies: 1 comment
-
Hello @ace19wre, and a good question! Java's streams do not have any requirements for incrementality, or for repeatability. Once a Java stream is terminated, you can never run it again. And every element only flows through it once. Java streams also don't have a concept of tuple cardinality (uni, bi, ...). For those reasons, the similarity between Java streams and Constraint Streams is only superficial - both are fluent APIs which allow for a less imperative approach to data processing, but many of their concepts aren't mutually transferrable. Constraint Streams share no implementation with Java streams, they are completely independent systems. When it comes to Gatherers specifically, you could argue Constraint Streams API already has a functionality like that. It's called a Constraint Collector, used with a groupBy building block. By implementing a custom Constraint Collector, you can accomplish pretty much any transformation. The problem of losing incrementality in Constraint Streams comes from collecting data into a |
Beta Was this translation helpful? Give feedback.
-
I have been poking around in the JDK preview and came across JEP 461: Stream Gatherers
From the proposal itself,
Stream::gather(Gatherer) is to intermediate operations what Stream::collect(Collector) is to terminal operations.
From the documentation of the solver :
But with few examples that I have seen so far the collectors are used as an intermidate step and not a terminal step( which I assume impacts the performance and hence should be avoided?), has there been any internal testing with Stream::gather(Gatherer) and are they viable to maintain Incremental Score Calculation Performance?
Beta Was this translation helpful? Give feedback.
All reactions