title: Creating a generic class where the parameter is an array
body: <p>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:</p>
  
  <pre><code>comparator.compare(new Integer[] {1,2}, new Integer[] {3,4,5});
  </code></pre>
  
  <p>the type of the parameters are not necessarily Integer[]. They could be an array of anything.</p>
  
  <p>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?</p>