stream流的sum方法
时间: 2023-10-24 12:29:27 浏览: 83
stream流的sum方法主要用于对整数类型的流进行求和。这个方法只能在整数类型的流中调用,对流中的所有元素进行求和操作。需要注意的是,这个方法是定义在IntStream接口中的,而不是Stream接口中。所以,如果你想对一个整数类型的流进行求和操作,可以使用sum方法。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [Lambda表达式九:Stream流三:Stream常用方法;](https://blog.csdn.net/csucsgoat/article/details/116130322)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* [undefined](undefined)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文