I’ve asked a question on ordering before but since there are so many possibilities brought up, I’m never sure how to proceed so am keen to know whether there is a clear winner.
I am using someone else’s class system. They have a subclass B of a class A. A implements Comparable.
I think from what I’ve read, since B doesn’t implement Comparable then only aspects of class A in objects of type B can be used when sorting. This wouldn’t be enough so I would like to create my own sorting methods for class B.
Without using extensions, what would be the most natural way to proceed? I understand there is a problem with Ordered / Ordering because of a bug that one of the classes has the wrong variance annotation.
Would implicits conversions be best to a class of my own and then making it implement say Ordered?
If so, which sort method would then be used to sort a list or array of objects of them?