jOOL
jOOL copied to clipboard
Pass appropriate java.util.stream.Collector.Characteristics to Collector API
java.util.stream.Stream can implement some optimisations if custom Collectors pass hints to the collect() API via java.util.stream.Collector.Characteristics. We should also pass these characteristics.
As you mostly ignore parallel streams, the only useful characteristic in your case is IDENTITY_FINISH which is automatically injected if you are using Collector.of without providing the finisher.
Thanks for the feedback, @amaembo. Within jOOλ, that's certainly true, but people might use the collectors exposed in Agg also for parallel JDK streams, or for StreamEx...