Sorting an array

Can you post the rest of your sketch for the second example?

From what you’ve posted so far, the one thing that stands out to me is it feels a little weird for the Point class to also be a Comparator for Point- I would expect Point to be a Comparable, and a Comparator to be a separact class. But I don’t see anything obviously wrong about what you have, so it probably depends on how you’re using it.

2 Likes