Well the underlying comparison must either:
add 1 to l, compare the result to r
or
subtract 1 from r and compare the result to l
All modern hardware will have the same raw performance for either operation (where addition and subtraction of any native data type has identical performance in terms of cycles to complete and pipeline side effects).
The only way this will have any effect is if:
one of l or r are known constants at compile time. eg.
l + 1 < 5
5 + 1 < r
in this case a poor optimizing compiler may not realise it can convert the first into l < 4
but all java compilers are required to spot that the second case is 6 < r
The other is if the data types of l and r are different.
The operation of :
- floating point addition/subtraction then comparison to an int
verses
- integral addition/subtraction then comparison with a double may be different.
It is fair to say that the chances of this being a serious issue in your application are negligible since the cycle cost of any of these is tiny compared to the pipeline hit of any branch mispredictions associated with the decision.
Also a decent JIT may do all sorts of optimizations in relation to the surrounding code that outweigh the micro optimization performed.