|While inspections provide quick-fixes for code that has potential problems, intentions help you apply automatic changes to code that is correct.|
To get a list of intentions applicable to the code at the caret, just press Alt + Enter.
Since the IDE is aware of the data flow in your code, it can help you optimize Boolean conditions and transform if/else statements:
With intentions you can, for example, automatically add and remove braces for your statements:
If you have String concatenation, the IDE can help you replace it with a String.format expression or a StringBuilder pattern.
With intentions you can also switch between loop declaration styles or even reverse its direction.
If you have a complicated math expression, the IDE will offer you to simplify an expression or possibly clarify it with parentheses.
If you don’t want to see a certain intention, you can disable it by selecting the right arrow on the intention.
The complete list of intentions (several hundred in total), grouped by language and framework, can be found in Settings → Intentions. Here you can enable/disable whole groups of intentions: