Java示例集合到数组 Java示例集合比较 Java示例打印集合 Java示例集合到数组 import java.util.*; public class CollectionToArray{ public static void main(String[] args){ List<String> list = new ArrayList<String>(); list.add("This "); list.add("is "); list.add("a "); list.add("good "); list.add("program."); String[] s1 = list.toArray(new String[0]); for(int i = 0; i< s1.length; ++i) { String contents = s1[i]; System.out.print(contents); } } } Java示例集合比较 Java示例打印集合