I had the below piece of code which returns ConcurrentModificationException. I could see some approaches to handle the same in java7. Instead what is the best way to handle the same in Java 8
List<String> mylist = new ArrayList<>();
mylist.add("test");
mylist.forEach(str -> {
if(str.equalsIgnoreCase("test"))
{
mylist.add("pass");
}
});