問題文
A team debates whether the comparator they wrote should override the equality method that it inherits. What does the interface say about that choice, and why?
選択肢
- Overriding that method is required of a comparator, because the interface says that it has to obey the general contract of the one it overrides, and any comparator that leaves it alone breaks that contract
- Leaving that method alone is the safe course, because the interface says that overriding it may let a program find that two comparators impose the same order, and only a gain in speed is at stake
- Overriding that method is required of a comparator, because the interface says that it may return the affirmative for another comparator that imposes the same order, and each holder counts on that answer
- Leaving that method alone is the safe course, because the interface says that overriding it may let a program find that two distinct comparators impose the same order, and every collection that holds one relies on that reading