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

正文內(nèi)容

第08章-集合操作-在線瀏覽

2024-11-05 19:10本頁面
  

【正文】 ublic class SetDemo6 { public static void main(String args[]) { Set s = new TreeSet()。 (new Integer(37))。 while (()) (())。 the objects are not parable D:\java SetDemo6 Exception in thread main D:\ ? The exception is thrown because an attempt is made to order the elements of the set. A String object has no relationship to an Integer object, so the relative order of the two objects cannot be determined. 17 1. 對(duì)數(shù)組對(duì)象的操作 (Arrays) 2. 對(duì)象集合 (Set) 3. 對(duì)象列表 (List) 4. 對(duì)象映射 (Map) 5. 對(duì)對(duì)象數(shù)組的操作 (Collections) 6. 枚舉 (Enumeration)和迭代 (Iterator) 7. 小結(jié) 第八章 集合操作 18 ? 有序?qū)ο蟮募? ? A List is an ordered collection (sometimes called a sequence). ? Lists can contain duplicate elements. ? The user can access elements by their integer index (position), and search for elements in the list. ? 方法操作 ? 列表與元素 ? 列表之間 對(duì)象列表 (List) 19 ? 接口 (列表與元素 ) ? public void add(int index, Object element) Inserts the specified element at the specified position in this list. ? public Object remove(int index) Removes the element at the specified position in this list. ? public boolean contains(Object o) Returns true if this list contains the specified element. ? public int indexOf(Object o) Returns the index in this list of the first occurrence of the specified element, or 1 if this list does not contain this element. 對(duì)象列表 (List) 20 ? 接口 (列表之間 ) ? public boolean addAll(Collection c) Appends all of the elements in the specified collection to the end of this list. ? public boolean removeAll(Collection c) Removes from this list all the elements that are contained in the specified collection. ? public boolean containsAll(Collection c) Returns true if this list contains all of the elements of the specified collection. ? public boolean retainAll(Collection c) Retains only the elements in this list that are contained in the specified collection. 對(duì)象列表 (List) 21 ? implements import .*。 for (int i = 1。 i++) (i + * + i + = + i * i)。 while (()) (())。 Object get(Object key)。 boolean containsKey(Object key)。 int size()。 // 批量操作 void putAll(Map t)。 // Collection Views public Set keySet()。 public Set entrySet()。 Object getValue()。 } ? 27 對(duì)象映射 (Map) import .*。 public static void main(String args[]) { Map m = new HashMap()。 i。 (args[i], (freq==null ? ONE:new Integer(() + 1)))。 (m)。 public class MapDemo2 { public static void main(String args[]) { Map m = new HashMap()。 (”Larry”, ”2345678”)。 Iterator iter = ().iterator()。 (() + ” ” + ())。 public class SortDemo { public static void main(String args[]) { List list = new ArrayList()。 (“DEF”)。 (list)。 while(()) (())。 iter = ()。 } } import .*。 String s2 = (String)o2。 } } class Collections ? public static void sort(List list) Sorts the specified list into ascending order, according to the natural ordering of its elements. class Collect
點(diǎn)擊復(fù)制文檔內(nèi)容
試題試卷相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1