For example, there are ten objects in the iterator. If you use next once, the first one will be removed. After all executions are completed, the iterator will be empty. If you still reference the objects in this iterator below, it will Null pointer reported
Is the following understanding correct?
Don’t save references to objects in iterators.
For example, there are ten objects in the iterator. If you use next once, the first one will be removed. After all executions are completed, the iterator will be empty. If you still reference the objects in this iterator below, it will Null pointer reported