Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/305.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java:Double无法转换为可比_Java_Comparable - Fatal编程技术网

Java:Double无法转换为可比

Java:Double无法转换为可比,java,comparable,Java,Comparable,我有一种改进的快速排序方法: public void quickSortModified(ArrayList<Comparable> vetor, int begin, int end) public void quickSortModified(ArrayList vetor,int begin,int end) 我尝试使用以下代码调用它: ArrayList <Double> variables = new ArrayList <Double>();

我有一种改进的快速排序方法:

public void quickSortModified(ArrayList<Comparable> vetor, int begin, int end)
public void quickSortModified(ArrayList vetor,int begin,int end)
我尝试使用以下代码调用它:

ArrayList <Double> variables = new ArrayList <Double>();
quickSortModified(variables, 0 , variables.size());
arraylistvariables=newarraylist();
quickSortModified(变量,0,variables.size());
Java会返回错误:

Incompatible types: ArrayList <Double> cannot be converted to ArrayList <Comparable>
不兼容类型:无法将ArrayList转换为ArrayList
如果Double实现可比较,为什么此代码不起作用?

ArrayListTry this:
public