我必须检查数组列表中的“令牌”是否按递增顺序排列。
private E[] data; // where the data is stored
private int size; // how many items have been added to the list
public TopSpinArray(int numTokens, int spinSize)
{
super(numTokens, spinSize);
data = (E[])(new Object[numTokens]);
size = 0;
}
public boolean isSolved()
{
for(int i = 0; i < numTokens; i++)
{
if(data[i] < data[i+1])
{
return true;
}
}
return false;
}
当我编译时,它说“二元运算符'<'第一种类型的错误操作数类型:E;第二种类型:E”
我如何检查它们是否在增加?