错误:private Array<E> array;,没有加<E>
忘记写@Override
public string toString() {
}
在循环队列中,dequeue操作中,下面两句写反了:
data[head] = null;
head = (head + 1) % (data.length);
private void resize(int newCapactiy) {
E[] newData = (E[]) new Object[newCapactiy + 1]; //+1忘写了
for (int i = 0; i < size; i++) {
newData[i] = data[(head + i) % data.length];
}
//下面三句忘写了
data = newData;
head = 0;
tail = size;
}
网友评论