Be careful not to keep references to the objects from this iterator.
To improve GC performance the same object is re-used in next()
.
请问这段注释是什么含义?
Be careful not to keep references to the objects from this iterator.
To improve GC performance the same object is re-used in next()
.
请问这段注释是什么含义?
8 回答6.4k 阅读
1 回答4.1k 阅读✓ 已解决
3 回答2.3k 阅读✓ 已解决
2 回答3.2k 阅读
2 回答3.9k 阅读
1 回答2.2k 阅读✓ 已解决
3 回答1.6k 阅读✓ 已解决
2 回答553 阅读✓ 已解决
5.8k 阅读
3 回答10.3k 阅读
2 回答2.1k 阅读✓ 已解决
1 回答4.2k 阅读
下面的理解对吗?
不要保存迭代器里的对象的引用。
举个例子, iterator里面有十个对象,你用一次next,第一个就被移出了,所有执行完,迭代器为空,如果你在下面还引用这个迭代器里的对象的话,就会报空指针了