Given DoubleStream s
, I can do s.min()
or s.max()
, but not both, as either of them will consume the stream.
Now suppose I have
class Range /* can add code here */ {
private final double min;
private final double max;
Range(double min, double max){
this.min = min;
this.max = max;
}
}
How can I get the flow range? (Except s.collect(Collectors.toList()); new Range(s.stream().min(),s.stream().max());
)
source
share