IntelliJ IDEA 14.1.0 Help

Invert Boolean

The Invert Boolean refactoring allows you to change the sense of a Boolean method or variable to the opposite one.

Example

Before After
private double a; method() { && a < 100) { true; e;
private double a; method() { && a < 100) { false; ;
boolean b = true; ethod() {
boolean b = false; ethod() {

To invert the sense of a boolean method or variable

  1. Place the caret at the name of the method or variable to be refactored.
  2. Do one of the following:
    • On the main menu choose Refactor | Invert Boolean.
    • On the context menu, choose Refactor | Invert Boolean.
  3. In the Invert Boolean dialog, specify the name for the inverted method or variable.
  4. Preview and apply changes.

See Also

Web Resources:

Last modified: 24 March 2015
comments powered by Disqus