第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會有你想問的

Java 基礎(chǔ) Collection

Java 基礎(chǔ) Collection

MYYA 2018-08-07 10:13:45
public static void main(String[] args) {Collection<String> col = new ArrayList<String>();Collection<String> cols = new ArrayList<String>();col.add("a");col.add("b");col.add("c");cols.addAll(col);cols.remove("b");cols.clear();System.out.println("col:"+col.toString());System.out.println("cols:"+cols.toString());System.out.println(col.contains(cols));boolean contains = col.containsAll(cols);if (contains) {System.out.println("Set集合包含List集合的內(nèi)容"+contains);} else {System.out.println("Set集合不包含List集合的內(nèi)容"+contains);}}為什么 結(jié)果是 true
查看完整描述

1 回答

?
精慕HU

TA貢獻(xiàn)1845條經(jīng)驗(yàn) 獲得超8個(gè)贊


哈哈,去本地模擬了一下這個(gè)程序。也是有點(diǎn)懵的,然后去看了看這個(gè)方法的Api

Returns true if this collection contains all of the elements in the specified collection.

因?yàn)?cols 為空啊,所以 col 肯定包含了cols 中的全部,明白了嗎?

ContainsAll List Java


查看完整回答
反對 回復(fù) 2018-08-27
  • 1 回答
  • 0 關(guān)注
  • 667 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號