真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

javaReduce的重載有哪些

這篇文章主要介紹了java Reduce的重載有哪些的相關(guān)知識,內(nèi)容詳細易懂,操作簡單快捷,具有一定借鑒價值,相信大家閱讀完這篇java Reduce的重載有哪些文章都會有所收獲,下面我們一起來看看吧。

專注于為中小企業(yè)提供網(wǎng)站設(shè)計制作、做網(wǎng)站服務(wù),電腦端+手機端+微信端的三站合一,更高效的管理,為中小企業(yè)湞江免費做網(wǎng)站提供優(yōu)質(zhì)的服務(wù)。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動了成百上千企業(yè)的穩(wěn)健成長,幫助中小企業(yè)通過網(wǎng)站建設(shè)實現(xiàn)規(guī)模擴充和轉(zhuǎn)變。

1、一個參數(shù)的reduce

格式

Optional reduce(BinaryOperator accumulator)
T result = a[0];  
for (int i = 1; i < n; i++) {
result = accumulator.apply(result, a[i]);  
}
return result;

2、兩個參數(shù)的reduce

格式

T reduce(T identity, BinaryOperator accumulator)
T result = identity;
for (int i = 0; i < n; i++) {
result = accumulator.apply(result, a[i]);  
}
return result;

3、三個參數(shù)的Reduce,其中g(shù)et和set方法使用時省略。

格式

 U reduce(U identity, BiFunction accumulator,BinaryOperator combiner);
static class ScoreBean {
private String name; //學(xué)生姓名
private int score;   //分數(shù),需要匯總該字段   
public ScoreBean(String name, int score) {
this.name = name;
this.score = score;
}
//get 和 set 方法省略
}

關(guān)于“java Reduce的重載有哪些”這篇文章的內(nèi)容就介紹到這里,感謝各位的閱讀!相信大家對“java Reduce的重載有哪些”知識都有一定的了解,大家如果還想學(xué)習(xí)更多知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。


當前文章:javaReduce的重載有哪些
網(wǎng)頁URL:http://weahome.cn/article/pdcsdd.html

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部