freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

java語言程序設(shè)計(jì)基礎(chǔ)第2版對(duì)象的串行化和聚集框架ppt(編輯修改稿)

2025-02-02 05:32 本頁面
 

【文章內(nèi)容簡介】 2021/11/10 49 比較常用的和 Collection相關(guān)的類 ? ArrayList ? LinkedList ? HashSet ? Vector ? Stack ? TreeSet 2021/11/10 50 ArrayList ? ArrayList實(shí)現(xiàn)了 List接口 ? ArrayList允許任何對(duì)象類型的數(shù)據(jù)作為它的元素 ? ArrayList允許 null作為它的元素 ? ArrayList是線程不安全的。即它不支持多線程。 2021/11/10 51 ArrayList的構(gòu)造方法 ? ArrayList() :構(gòu)造一個(gè)空的 ArrayList對(duì)象,同時(shí)為其分配一個(gè)默認(rèn)大小的容量 ? ArrayList(Collection c) :構(gòu)造一個(gè)和參數(shù) c中具有相同元素的 ArrayList對(duì)象 ? ArrayList(int initialCapacity) :構(gòu)造一個(gè)空的 ArrayList對(duì)象,同時(shí)為其分配大小為initialCapacity的容量。 2021/11/10 52 ArrayList中的主要方法 ? add(int index, Object element):在 ArrayList的index位置上添加一個(gè)元素。 ? add(Object o): 向 ArrayList的末尾添加一個(gè)元素 ? addAll(Collection c):將 c中的內(nèi)容添加到 ArrayList的末尾 ? clear() :清除 ArrayList中的所有的元素 ? contains(Object elem) :判斷當(dāng)前的對(duì)象是否在ArrayList中 ? get(int index) :獲取 ArrayList中位于 index位置的元素 2021/11/10 53 ArrayList中的方法 ? indexOf(Object elem) : ? isEmpty() :判斷 ArrayList中是否存在元素 ? remove(int index):清除 ArrayList中位于 index位置的元素 ? set(int index, Object element):將 ArrayList中位于 index位置的元素替換為當(dāng)前對(duì)象 ? size():獲取 ArrayList中包含元素的個(gè)數(shù) ? toArray():返回一個(gè)包含 ArrayList中所有元素的數(shù)組 2021/11/10 54 LinkedList ? LinkedList實(shí)現(xiàn)了 List接口 ? LinkedList允許任何對(duì)象類型的數(shù)據(jù)作為它的元素 ? LinkedList允許 null作為它的元素 ? LinkedList是線程不安全的 ? LinkedList中添加了針對(duì)初始元素和結(jié)束元素的get和 set等等的操作 ? LinkedList通??梢援?dāng)作隊(duì)列、雙端隊(duì)列和堆棧等等的結(jié)構(gòu)使用 2021/11/10 55 LinkedList的構(gòu)造方法 ? LinkedList():構(gòu)造一個(gè)空的 LinkedList對(duì)象 ? LinkedList(Collection c) :構(gòu)造一個(gè)包含與 c中相同的元素的 LinkedList對(duì)象 2021/11/10 56 LinkedList中與首尾元素相關(guān)方法 ? addFirst(Object o):將當(dāng)前元素添加到 LinkedList的首位置上 ? addLast(Object o) :將當(dāng)前元素添加到 LinkedList的末尾 ? getFirst() :獲取 LinkedList中首位置的元素 ? getLast() :獲取 LinkedList中末尾位置的元素 ? removeFirst() :刪除 LinkedList中首位置的元素 ? removeLast() :刪除 LinkedList中末尾位置的元素 2021/11/10 57 HashSet ? HashSet執(zhí)行了 Set接口,同時(shí)以哈希表為基礎(chǔ) ? HashSet對(duì)存入其中的元素不進(jìn)行排序 ? HashSet允許存入其中的元素為空 ? HashSet中的元素不允許重復(fù) ?如果 HashSet中保存的元素較多時(shí),其訪問速度會(huì)強(qiáng)于 List 2021/11/10 58 HashSet的構(gòu)造方法 ? HashSet():定義一個(gè)空的 HashSet對(duì)象,同時(shí)為其分配默認(rèn)的初始容量,使用默認(rèn)的加載因子 ? HashSet(Collection c) :定義一個(gè)具有和給定的Collection中具有相同元素的 HashSet對(duì)象,同時(shí)為其分配默認(rèn)的初始容量,使用默認(rèn)的加載因子 ? HashSet(int initialCapacity):定義一個(gè)空的 HashSet對(duì)象,同時(shí)為其分配指定的初始容量 ? HashSet(int initialCapacity, float loadFactor):定義一個(gè)空的 HashSet對(duì)象,同時(shí)為其分配指定的初始容量,使用指定的加載因子 2021/11/10 59 HashSet中的方法 ? add(Object o):向 HashSet中添加對(duì)象 ? clear() :將 HashSet中的所有對(duì)象清空 ? contains(Object o) :判斷 HashSet中是否存在給定對(duì)象 ? isEmpty() :判斷 HashSet中是否存在元素 ? remove(Object o) :將給定的元素從HashSet中刪除 ? size():獲取 HashSet中元素的個(gè)數(shù) 2021/11/10 60 Vector ? Vector實(shí)現(xiàn)了 List接口 ? Vector的大小可以在元素進(jìn)行添加和刪除時(shí)根據(jù)需要自動(dòng)進(jìn)行擴(kuò)充和縮減 ? Vector是線程安全的 2021/11/10 61 Vector的構(gòu)造方法 ? Vector( ):創(chuàng)建一個(gè)元素個(gè)數(shù)為 0的 Vector對(duì)象,并為其分配默認(rèn)大小的初始容量 ? Vector(int size):創(chuàng)建一個(gè)元素個(gè)數(shù)為 0的 Vector對(duì)象,并為其分配大小為 size的初始容量 ? Vector(int size, int incr):創(chuàng)建一個(gè)元素個(gè)數(shù)為 0的 Vector對(duì)象,為其分配大小為 size的初始容量,并指定當(dāng) Vector對(duì)象溢出時(shí)自動(dòng)增加大小為 incr的容量。 ? Vector(Collection c):創(chuàng)建一個(gè)包含了聚集 c中元素的 Vector對(duì)象。 2021/11/10 62 Vector中的方法 ? add(int index, Object element):將 element添加到index位置上 ? add(Object o):將對(duì)象添加到 Vector的末尾 ? addAll(Collection c) :將 c中所有的元素添加到Vector的末尾 ? addAll(int index, Collection c):將 c中所有的元素添加到 index位置上 ? addElement(Object obj) :將對(duì)象添加到 Vector的末尾 ? contains(Object elem) :判斷 Vector中是否包含當(dāng)前元素 2021/11/10 63 Vector中的方法 ? containsAll(Collection c) :判斷 Vector中是否包含 c中包含的所有元素 ? copyInto(Object[] anArray):將 Vector中的所有元素保存到給定的數(shù)組中 ? elementAt(int index):獲取位于 Vector中 index位置的元素 ? firstElement():獲取 Vector中排列在第一位的元素 ? get(int index) :獲取 Vector中 index位置上的元素 ? indexOf(Object elem) :獲取當(dāng)前對(duì)象在 Vector中的位置索引 2021/11/10 64 Vector中的方法 ? indexOf(Object elem, int index) :獲取當(dāng)前對(duì)象在Vector中 index位置之后的位置索引 ? insertElementAt(Object obj, int index) :將對(duì)象插入到 Vector的指定位置上 ? remove(Object o) :從 Vector中刪除指定的元素 ? remove(int index) :從 Vector中刪除指定位置的元素 ? removeAllElements():刪除 Vector中的所有元素 ? setElementAt(Object obj, int index) :將 Vectory中index位置上的元素替換為指定對(duì)象 ? size():獲取 Vector中所包含的元素的個(gè)數(shù) ? toArray():返回由 Vector中所有元素組成的數(shù)組 2021/11/10 65 Vector使用舉例 import .*。 public class VectorExample { public static void main(String args[]) { Vector v = new Vector(2, 1)。 (向量初始大小 : + ())。 (向量初始容量 : +())。 (new Integer(1))。 (new Integer(2))。 (new Integer(3))。 2021/11/10 66 (new Integer(4))。 (加 4個(gè)整數(shù)元素后的容量 :
點(diǎn)擊復(fù)制文檔內(nèi)容
教學(xué)課件相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號(hào)-1