开发者

Comparing an array and arrayList indexes

开发者 https://www.devze.com 2023-01-16 23:16 出处:网络
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 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

精彩评论

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

关注公众号