Submit via Blackboard.
In the in-class exercise of Monday, October 22, we will determine that
Comparator based on absolute values is problematic.
Code up the comparator and then write client
code that illustrates the problem.
Explain what is wrong in a brief summary statement.
Your explanation of the problem must be phrased in terms of
a violation of
the contract for
To emphasize that this contract problem is real,
your code should create two Java sets,
and the other a
TreeSet should order items
with your absolute value comparator.
Your example should add the same integers
to both sets, yet still end up with sets that are different.
Your summary statement should explain why.