using an iterator to solve the concurrent modification exception, caused by using for loop.
for (Iteratorit = foundCopy.iterator(); it.hasNext();) { Yard yard = it.next(); if (checked.contains(yard.getInterest())) { it.remove(); } }
Or usign java 8, streaming and then filtering.
No comments:
Post a Comment