On Wed, 17 Apr 2024 06:24:51 GMT, Tejesh R <[email protected]> wrote: >> Exactly, similar thing applies to && and hence in failure condition || >> checks for all the colors while && drops off at first failure only. Which is >> why I suggested it would be better for failure cases. > > Yeah, its `!=` here right, then it'll fail fast for failure conditions...... > Then no need to optimize......
In && operator if condition evaluate to false it will not check further. Similarly, in || operator if condition evaluate to true it will not check further. So if c1.getRed() != c2.getRed() evaluates to true, it will not check further and fail immediately. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/18644#discussion_r1568288763
