📄 addinggroups.java
字号:
package chapter11;
import java.util.*;
public class AddingGroups {
public static void main(String args[]){
Collection<Integer> collection=new
ArrayList<Integer>(Arrays.asList(1,2,3));
Integer moreInts[]={4,5,6};
collection.addAll(Arrays.asList(moreInts));
Collections.addAll(collection, 111);
/*
* Collection添加的必须是一个Collection的一个实例
*
*/
for(Integer x:collection){
System.out.print(x+" ");
}
System.out.println();
List<Integer> list=Arrays.asList(22,23,24);
list.set(1, 10000);
/*
* 在这里修改第二个元素。
*/
for(Integer y:list){
System.out.print(y+" ");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -