Java boolean returns an if statement

Java boolean returns an if statement … here is a solution to the problem.

Java boolean returns an if statement

Can anyone explain the logic behind this statement in plain English?

return mContainsLoadingRow ? (getContentDataSize() + 1) : getContentDataSize();

Suppose mContainsLoadingRow is

a boolean value if mContainsLoadingRow is true

It then returns getContentDataSize() + 1.

If not, getContentDataSize() is returned.

Is this the right way to look at this?

Related Problems and Solutions