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/