关于集合类的操作
package com.zcl.collection;import java.util.ArrayList;import java.util.Collection;public class CollectionToArray{ /** * Collection方法的测试: */ public static void main(String[] args) { Collection collection1=new ArrayList(); collection1.add("000"); collection1.add("111"); collection1.add("222"); System.out.println("集合collection1的大小:"+collection1.size()); System.out.println("集合collection1的内容:"+collection1); collection1.remove("000"); System.out.println("集合collection1移除000后的内容:"+collection1); System.out.println("集合collection1是否包含000:"+collection1.contains("000")); System.out.println("集合collection1是否包含111:"+collection1.contains("111")); Collection collection2=new ArrayList(); collection2.addAll(collection1); System.out.println("集合collection2的内容:"+collection2); collection2.clear(); System.out.println("集合collection2是否为空:"+collection2.isEmpty()); Object s[]=collection1.toArray(); for(int i=0;i<s.length;i++) { System.out.println(s[i]); } }}?