java - Swing 的removeAll() 是否将所有删除的元素设置为null?

标签 java swing garbage-collection removeall

Container removeAll() 方法是否将所有已删除组件的值设置为 null?如果是这样,如何从 Container 中删除所有元素而不将它们设置为 null?如果不是,如何确保垃圾收集器在覆盖未使用的元素后删除它们?

最佳答案

Does the Container removeAll() method set the value of all removed components to null?

(参见here)

How can I remove all elements from a Container without setting them to null?

Container 有一个与其关联的 Components 数组,如果您想删除它,可以将其设置为 null 或将其设置为其他一些值

How can I ensure the garbage collector removes unused elements after I've overwritten them?

如果没有对这些 Component 实例的 Activity 引用,它将有资格进行 GC

关于java - Swing 的removeAll() 是否将所有删除的元素设置为null?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24373850/

相关文章:

java - 如何在矩形内写文字

java - 当我在共享登录节点中启动 Spark-Shell 时,JVM GC 出了什么问题?

java - Tomcat、JBoss 和 Glassfish 有什么区别?

java - ElasticSearch 只返回具有不同值的文档

java - JTable模型列

java - GUI框架很大,与我的java设计不符

node.js - 如何从代码中获取max_old_space_size的值?

.net - vb.net 中的多个 "= new"具有相同的变量。垃圾收集会处理吗?如何处理?

java - 返回ArrayList并在另一个方法中使用它

java - 有没有办法将字符添加到堆栈?