?? 群體簡介.txt
字號:
群體簡介 List.1 Collection.txt
群體簡介 List.2 ContainerDemo/ContainerDemo.java
--------------------------------------------------------------------------------
群體簡介 List.1 Collection.txt
Return to top
001: // Collection interface methods
002: int size();
003: boolean isEmpty();
004: boolean contains(Object o);
005: Iterator iterator();
006: Object[] toArray();
007: Object[] toArray(Object a[]);
008: boolean add(Object o);
009: boolean remove(Object o);
010: boolean containsAll(Collection c);
011: boolean addAll(Collection c);
012: boolean removeAll(Collection c);
013: boolean retainAll(Collection c);
014: void clear();
015: boolean equals(Object o);
016: int hashCode();
Return to top
--------------------------------------------------------------------------------
群體簡介 List.2 ContainerDemo/ContainerDemo.java
Return to top
001: import java.util.ArrayList;
002:
003: class ContainerDemo {
004: public static void main(String args[]) {
005: ArrayList myList = new ArrayList(25);
006: myList.add(new String("One"));
007: myList.add(new String("Two"));
008: myList.add("Buckle");
009: String s = "My shoe";
010: myList.add(s);
011: System.out.println("There are " +
012: myList.size() + " strings in myList");
013: for (int i = 0; i < myList.size(); i++)
014: System.out.println(myList.get(i));
015: }
016: }
Return to top
? 2003 by ChinaITLab.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -