Sorting data of any type using the Comparable interface
<p>I am trying to write a simple <code>sort</code>  function that can sort data of any type using the <code>Comparable</code> interface. I think I have done that, but I am having problems passing arrays of specific types as arguments. The code is</p>

<pre><code>public class Main {
    public static void main(String[] args) {
        int[] arr= {12,14,11,6};
            // The above gives error
            // But this works : Comparable[] arr= {12,14,11,6};
        Comparable b[]= Selection.sort(arr);
        for (Comparable x:b)
            System.out.println(x);
    }
}
</code></pre>

<p>What is the probelm ? The error reads : <code>Comparable is a raw type. References to generic type Comparable&lt;T&gt; shoulb be parameterized.</code></p>

<p>Just to make it more clear, the remaining code is:</p>

<pre><code>public class Selection {

    public static Comparable[] sort(Comparable[] a){
        int N= a.length;

        for(int i=0;i&lt;N;i++){
            int min=i;
            for(int j=i+1;j&lt;N;j++)
                if(less(a[j],a[min]))
                    min=j;

            exch(a,i,min);
        }
        return a;
    }

    // Other methods defined here
}
</code></pre>
