Saturday, 6 January 2018

java.util.ConcurrentModificationException: null

This error happens when removing an element in a for- loop.  Using an iterator and its remove method then the error will be solved.


using an iterator to solve the concurrent modification exception, caused by using for loop.
            for (Iterator it = 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:

Can Jackson Deserialize Java Time ZonedDateTime

Yes, but must include JSR310. Thus ZonedDateTime can be deserialized directly from JSON response to POJO field. <dependency> <g...