This rule is Obsolete | |
Synopsis: | Use bitwise inversion to invert boolean values |
Language: | Java |
Severity Level: | 7 |
Category: | Controversial |
Description: |
Use bitwise inversion to invert boolean values - it's the fastest way to do this.
See http://www.javaspecialists.co.za/archive/newsletter.do?issue=042&locale=en_US for specific detailspublic class Foo { public void main(bar) { boolean b = true; b = !b; // slow b ^= true; // fast } } |