I came across a code snippet inside the androidx.lifecycle package and I was wondering what does this means.
LiveData.this.mActiveCount += mActive ? 1 : -1;
Where mActiveCount is an int, and mActive is a boolean.
But, as I was writting this question, I think I came with the answer, so if I'm not mistaken the "+=" operator, is used as we normally use the "=" operator.
This means that the order in which the code executes is the following:
the mActive ? 1 : -1; portion executes first.
Once this is resolved, the LiveData.this.mActiveCount += mActive executes. So my real question is:
Is this the correct equivalence of this code?:
int intToAdd = mActive ? 1 : -1;
activeCount += intToAdd;