On Wednesday, June 25, 2014 09:46:12 AM Kristian Rosenvold wrote: > I've been acquainting myself with the jena code base by trying to find > out how to add idiomatically correct java8-style iteration to jena > (while staying java7 compatible). > > ..., but even on my first > attempt at actually modifying a model I was iterating over ...
The tradition in Java and Jena has been: don't do that. Else BOOM. Has the Java approach changed in java8? > it fell > over because the consistency is only partial. Could you be more specific about what you did and what happened? > Is there any > documentation as to what operations are permitted/safe/unsafe while > iterating ? "Don't change the model and continue iterating." At the time Jena iterators were designed/built, Java iterators over collections had that same restriction; it avoids the inconvenience of defining and implementing some less explosive behaviour. If we were to have different modes -- fail-fast vs consistent -- I think they'd have to be visible in the type system, which in turn suggests that we'd have two versions of every iterator, which does not feel like a good thing. But maybe there's something better we can do? Chris -- "How am I to understand if you won't teach me?" - Trippa, /Falling/ Epimorphics Ltd, http://www.epimorphics.com Registered address: Court Lodge, 105 High Street, Portishead, Bristol BS20 6PT Epimorphics Ltd. is a limited company registered in England (number 7016688)
