Java利用Collections實(shí)現(xiàn)獲取list集合的極值?很多新手對(duì)此不是很清楚,為了幫助大家解決這個(gè)難題,下面小編將為大家詳細(xì)講解,有這方面需求的人可以來(lái)學(xué)習(xí)下,希望你能有所收獲。

package com.jalor;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class Jalor_20180728 {
public static void main(String[] args) {
List<Integer> rst2 = new ArrayList<>();
rst2.add(1);
rst2.add(2);
rst2.add(3);
rst2.add(8);
rst2.add(0);
Collections.max(rst2);
Collections.min(rst2);
System.out.println("max: "+ Collections.max(rst2));
System.out.println("min: "+ Collections.min(rst2));
}
}
新聞標(biāo)題:Java利用Collections實(shí)現(xiàn)獲取list集合的極值-創(chuàng)新互聯(lián)
文章起源:http://www.chinadenli.net/article42/dpsihc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供云服務(wù)器、Google、網(wǎng)站收錄、品牌網(wǎng)站建設(shè)、軟件開(kāi)發(fā)、網(wǎng)站設(shè)計(jì)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀(guān)點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容