Getting the range of a numeric stream

前端 未结 1 1252
没有蜡笔的小新
没有蜡笔的小新 2020-12-11 07:59

Given a DoubleStream s, I can do s.min() or s.max() but not both, as any one of them will consume the stream.

Now suppose I ha

相关标签:
1条回答
  • 2020-12-11 08:33

    You can call DoubleStream's summaryStatistics method. It returns a DoubleSummaryStatistics object that contains a min and a max, plus a few other statistics: average, count, and sum.

    IntStream and LongStream have similar summaryStatistics methods.

    0 讨论(0)
提交回复
热议问题