Hi.
I have a list of objects of the same class. The order of the list is not important.
What i want to do, is to (using bitwise operations) determine whether i should set some field with an incremental value or not. But the trick is that i want need this operation to return false (must not set field) only for the first element.
for (Obj obj:list){
if (obj.isZero() (op) some_flag){
//set field
}
}
Here are some things that im certain of.
When called on the first element of the list, isZero() will return true.
When called on the rest of the elements, its uncertain. But if called on the second element, isZero() returns true, then it will return true for all the list ([3..last])
Any way of doing this? I dont feel like keeping a counter and incrementing it, but if its THE BEST PRACTICE to do so, then ill do it.