我有一个自定义的“堆”类:
public class Heap<T extends Comparable<T>>
{
ArrayList<T> heapList;
public Heap()
{
heapList = new ArrayList<T>();
}
和一个自定义的“进程”类:
public class Process {
private int processID, timeUnitsRequired, priority, timeOfArrival;
public Process(int processID, int timeUnitsRequired, int priority, int timeOfArrival) {
this.processID = processID;
this.timeUnitsRequired = timeUnitsRequired;
this.priority = priority;
this.timeOfArrival = timeOfArrival;
}
但是如果我尝试创建一个新的进程堆,就像Heap<Process> processHeap = new Heap<Process>();
我得到以下错误一样:
绑定不匹配:类型 Process 不是 Heap 类型的有界参数的有效替代品
为什么是这样?我似乎无法弄清楚。