【发布时间】:2014-09-11 12:40:27
【问题描述】:
根据Javadoc:
无效清除()
Removes all of the elements from this list (optional operation). The list will be empty after this call returns.
为什么清除列表是可选操作?
这不会清除 RAM 以清除包含数千个对象的列表吗?
【问题讨论】:
-
@Joe 这不是重复的,因为另一个问题只询问什么是可选操作,而这个问题询问为什么特定方法是可选的。
-
检查 cmets 和其他答案。 “如果你有一个 ImmutableSet,那么如果该操作不存在是有意义的”已经存在于现有问题中。