Here is my code for arrayList ,
String[] n = new String[]{\"google\",\"microsoft\",\"apple\"}; final List list = new ArrayList
Why to add and then remove ?
add
remove
Check before adding.
adding
String[] n = new String[]{"google","microsoft","apple"}; final List list = new ArrayList(); for (String string : n) { if(string.indexOf("le") <0){ list.add(string); } }
That add's only one element microsoft to the list.
microsoft