Here is my code for arrayList ,
String[] n = new String[]{\"google\",\"microsoft\",\"apple\"};
final List list = new ArrayList
use the following code.
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
public class RemoveElements {
/**
* @param args
*/
public static void main(String[] args) {
String[] n = new String[]{"google","microsoft","apple"};
List list = new ArrayList();
Collections.addAll(list, n);
System.out.println("list"+list);
Iterator iter = list.iterator();
while(iter.hasNext()){
if(iter.next().contains("le"))
iter.remove();
}
System.out.println("list"+list);
}
}