默认容量大小:
DEFAULT_CAPACITY=10;
遍历有:
for,增强for,迭代器Iterator,列表迭代器ListIterator,使用枚举器:Enumeration
LinkedList:
增强for循环
for (Object object:list) {
Student student=(Student)object;
System.out.println(student.toString());
}
//迭代器
Iterator<Object> it = list.iterator();
while (it.hasNext()){
Student s =(Student) it.next();
System.out.println(s.toString());
}
//列表迭代器
ListIterator lis = list.listIterator();
while (lis.hasNext()) {
Student s=(Student) lis.next();
System.out.println(s.toString());
}
System.out.println(list.contains(s1));