今天无聊就整些问题来长长见识
/** * 删除arraylist中的某个元素 * @author: lyq * @date: May 27, 2014 2:21:53 PM */ public static void testListRemoveOne(){ ArrayList list= new ArrayList(); list.add("1"); list.add("2"); list.add("3"); Iterator itr = list.iterator(); String delContent = ""; while(itr.hasNext()){ delContent = (String)itr.next(); if(delContent.equals("2")) { itr.remove(); } } for(int i=0;i<list.size();i++){ System.out.println(list.get(i).toString()); } }