As in C++ iterator.remove() is not 100% safe or robust does java guarantees 100% robustness with iterator.remove()?
Going off of matt's comment (who really deserves the credit)
http://java.sun.com/javase/6/docs/api/java/util/Iterator.html#remove%28%29
says:
voidremove()Removes from the underlying collection the last element returned by the iterator (optional operation). This method can be called only once per call to next. The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method.
So...... yes, there are conditions under which unexpected/unsafe behaviour can occur.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With