I want to create a class that exends Comparator. This comparator will compare two arrays, where the arrays can contain anything that is comparable. Something that would let me do things like this:
comparator.compare(new Integer[] {1,2}, new Integer[] {3,4,5});
the type of the parameters are not necessarily Integer[]. They could be an array of anything.
Is there any way I can create such a class using generics? Or should my comparator receive objects instead. If it must receive objects, how can I check if it is an array and get elements from inside it?
How about using the array itself as the type parameter to
Comparator?