List books=new ArrayList();
books.add("輕量級(jí)java");
books.add("瘋狂java");
books.add("瘋狂android");
for(int i=0;i<books.size();i++){
System.out.println(books.get(i));
}
Iterator it=books.iterator();
while(it.hasNext()){
String book=(String) it.next();
System.out.println(book);
if(book.equals("瘋狂java")){
//it.remove();
//books.remove(book);
}
}
for(Object obj:books){
String book=(String) obj;
System.out.println(book);
}
待續(xù)