The code given below dont throw a ConcurrentModificationException.But if i add 2 more elements into the LinkedList, it throws the Exception. Why ?
List<String> list = new LinkedList<String>();
list.add("A");
list.add("B");
for (String s : list) {
if (s.equals("B")) {
list.remove(s);
}
}