JAVA.util.List
常用方法
public static void main(String[] args) {
List list1=new ArrayList();
list1.add(11);
list1.add("fdfsf");
//输出 1
System.out.println(list1);
//输出 2
int n=list1.size();
for(int i=0;i<n;i++) {
System.out.println(list1.get(i));
}
//输出 3
for(Object t:list1) {
System.out.print(t+" ");
}
System.out.println();
}
//输出4
Iterator it = list1.iterator();
while(it.hasNext()) {
Object object=it.next();
System.out.println(object);
}
Set list1=new HashSet();//元素不能重复