0

I have a modified quick sort method:

public void quickSortModified(ArrayList<Comparable> vetor, int begin, int end)

And I try to call it using the following code:

ArrayList <Double> variables = new ArrayList <Double>();
quickSortModified(variables, 0 , variables.size());

And Java returns me the error:

Incompatible types: ArrayList <Double> cannot be converted to ArrayList <Comparable>

If Double implements Comparable, why this code does not work?

Mr Guliarte
  • 739
  • 1
  • 10
  • 27
  • `ArrayList>`. Although, you may find you need a type variable (so it is e.g. `public > void qSM(ArrayList vetor, ...)`) so that you can refer to instances in your method. – Andy Turner Jul 02 '17 at 19:29
  • Try this: `public > void quickSortModified(List vector, int begin, int end)` – shmosel Jul 02 '17 at 19:47

0 Answers0