国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
Java中Collection、List的使用
 Collection的使用

  List list = new ArrayList();

  String str = "hello";

  list.add(str);

  Integer integer =new Integer(1);

  list.add(integer);

  //取出list中的值

  String str2 = (String)list.get(0);

  System.out.println(str2);

  System.out.println(list.size());

  //iterator迭代器

  List intList = new ArrayList();

  for(int i=0;i<10;i++)

  {

  intList.add("i"+i);

  }

  Iterator it = intList.iterator();

  while(it.hasNext()){

  String inte = (String)it.next();

  System.out.println(inte);

  }

  System.out.println("=================================for===========================================");

  for(int j=0;j<intList.size();j++)

  {

  System.out.println(intList.get(j));

  }
 List的使用

  Collection  collection =  new ArrayList();

  //向容器中加入對(duì)象

  String str = "Hello";

  collection.add(str);

  Integer integer = new Integer(1);

  collection.add(integer);

  Object obj = new Object();

  collection.add(obj);

  //返回容器長度

  //size返回collection中的元素?cái)?shù)

  System.out.println("容器的長度:"+collection.size());

  //如何取對(duì)象?

  Object[] object  = collection.toArray();

  //未進(jìn)行類型轉(zhuǎn)換

  System.out.println("第一個(gè)元素是:"+object[0]);

  //移除容器中制定的對(duì)象

  collection.remove(obj);

  //清空容器中的對(duì)象

  collection.clear();

  System.out.println("容器的長度:"+collection.size());

本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
Array.asList()用法--轉(zhuǎn)2
[JAVA · 初級(jí)]:容器類
高效的找出兩個(gè)List中的不同元素
Java數(shù)組轉(zhuǎn)List的三種方式及對(duì)比
Java基礎(chǔ)Map
Java集合框架
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服