package cn;
import java.util.*;public class tt {
public static void main(String[] args) {
Collection<Integer> collection =
new ArrayList<Integer>(Arrays.asList(1, 2, 3, 4, 5));
Integer[] moreInts = { 6, 7, 8, 9, 10 };
collection.addAll(Arrays.asList(moreInts));
// Runs significantly faster, but you can't
// construct a Collection this way:
Collections.addAll(collection, 11, 12, 13, 14, 15);
Collections.addAll(collection, moreInts);
// Produces a list "backed by" an array:
List<Integer> list = Arrays.asList(16, 17, 18, 19, 20);
list.set(1, 99); // OK -- modify an element
//list.add(21); // Runtime error because the
// underlying array cannot be resized.
for(Integer c: collection){
System.out.println(c);
}
}
} ///:~
import java.util.*;public class tt {
public static void main(String[] args) {
Collection<Integer> collection =
new ArrayList<Integer>(Arrays.asList(1, 2, 3, 4, 5));
Integer[] moreInts = { 6, 7, 8, 9, 10 };
collection.addAll(Arrays.asList(moreInts));
// Runs significantly faster, but you can't
// construct a Collection this way:
Collections.addAll(collection, 11, 12, 13, 14, 15);
Collections.addAll(collection, moreInts);
// Produces a list "backed by" an array:
List<Integer> list = Arrays.asList(16, 17, 18, 19, 20);
list.set(1, 99); // OK -- modify an element
//list.add(21); // Runtime error because the
// underlying array cannot be resized.
for(Integer c: collection){
System.out.println(c);
}
}
} ///:~
解决方案 »
- 数据库源码
- 这段代码执行时,为什么报空指针异常?(有关同步)
- 这个JAVA代码谁能帮我加个注释
- 刚学java,提几个菜鸟问题..............
- Hashmap排序相关问题!谢谢!
- MyEclipse、 j2sdk-1_4_2、tomcat-4.1.24他们都起着什么作用啊?并且它们是如何在 MyEclipse 中进行配制呢?
- (高分求助)linux下,java如何访问win2000下的sqlserver?(在线等)
- 為什么imap.21cn.com能ping通﹐但在瀏覽器中缺不能訪問呢﹖謝謝﹗﹗
- 真奇怪,各位大虾过来看看
- java的末日!!!!!!!
- 一个系统多个Java版本,正确的启动选择
- 如何取defaulttablemodel一行的数据
楼主【zzzkkk666】截止到2008-07-12 22:47:05的历史汇总数据(不包括此帖):
发帖的总数量:34 发帖的总分数:827 每贴平均分数:24
回帖的总数量:102 得分贴总数量:12 回帖的得分率:11%
结贴的总数量:33 结贴的总分数:827
无满意结贴数:3 无满意结贴分:70
未结的帖子数:1 未结的总分数:0
结贴的百分比:97.06 % 结分的百分比:100.00%
无满意结贴率:9.09 % 无满意结分率:8.46 %
值得尊敬