开发者

Comparing an array and arrayList indexes

I was wonderi开发者_如何学Gong if there was any way that i could compare and index of an arrayList and a array. I tried using the > operator and that didn't work.

I have tried something like this

if(ArrayVar[i] > arrayList.get(i) )

and i get errors.


You say that the array is of type Object and the arrayList is an Integer type. You are comparing apples and oranges.

Assuming the array acutally holds Integers as their Objects, you can cast that to an Integer and do the comparison then.

If the array doesn't have Integers (or any kind of number) how do you expect to compare them?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜