java - not to keep references to the objects from this iterator ?
大家讲道理
大家讲道理 2017-04-17 17:14:31
0
1
876

Be careful not to keep references to the objects from this iterator.
To improve GC performance the same object is re-used in next().

请问这段注释是什么含义?

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(1)
阿神

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template