Fred Leaf wrote:Is there a way to convince ecplise that the two object I am to compare are of the same object?
Stephan van Hulst wrote:Well, you're using wildcards, so you're essentially saying: "I don't care what types these are exactly". The point is that you *do* care. You care that whatever the types are, they are the same. So you should use type parameters, not wildcards.
You also shouldn't be using a global field to do operations on during a sort. Two sorts are independent from each other, so they should perform operations on data that is local to the method. Pass the array to your helper method, don't store it in a static variable.
Matthew Brown wrote:Hi Fred. Welcome to The Ranch!
One other point about your code, not related to generics. You seem to be expecting that a.compareTo(b) will always return -1 if a is less than b. That's not true - all the definition of compareTo requires is that it returns a number less than 0. So check for that instead.