底层是跟着老师写的动态数组。
private Array<E> data;
public MaxHeap(int capacity){
data=new Array<>(capacity);
}
public MaxHeap(){
data=new Array<>();
}
以下代码出现问题
E t=data[i]; //The type of the expression must be an array type but it resolved to Array<E>
data[i]=data[j];
data[j]=t;
The type of the expression must be an array type but it resolved to Array<E>
鼠标悬停在data[i]出现以上字段.
使用data.get(i)=data.get(j)时也出现错误