summaryStatistics Method of IntSummaryStatistics

前端 未结 4 1965
轮回少年
轮回少年 2021-01-23 17:27

Why summaryStatistics() method on an empty IntStream returns max and min value of integer as the maximum and minimum int value present in the stream?

IntStream          


        
4条回答
  •  春和景丽
    2021-01-23 17:37

    Since the list is empty and those methods return an actual value and not an Optional it assumes the full Integer range. Otherwise it would return an empty Optional.

提交回复
热议问题