I have a function whose parameter is List<Long> l
.
In the function there is a if
statement for which I have to iterate over each value stored in the List<Long> l
.
I'm trying to do this:
public void myFunction(final List<Long> l) {
final int size = l.size();
for (int i = 0; i < size; i++){
if (l.get(i) <= 900) {
...
Log.d("resultL", String.valueOf(l.get(i)));
} else {
}
}
}
here resultL
logged only -64338
the values stored in the List<Long> l
are [-64338, -15512, -15224, 8344]
, but what is happening is that the if
statement is using only -64338
and doing the logic instead of using all the 4 values.
Why is this happening?
How to iterate over all the 4 values stored here and not just one?
Please help with this issue.
Aucun commentaire:
Enregistrer un commentaire