Skip to end of metadata
Go to start of metadata

Redirection Notice


Folding helps you keep your code neat and readable, by automatically collapsing the boilerplate or by replacing it with more relevant statements.

You can see the original code behind the folded regions by placing the caret on it, or by moving the mouse over the collapsed pieces of code. Additionally you can always expand or collapse the folded blocks at the caret by calling the Toggle folding action via the shortcut
Ctrl + . (Cmd + . for Mac).

1. Generics

A very basic example of code folding is when the editor replaces parameter types in generics with the diamond operator added in Java 7. The code itself remains the same but it looks shorter and clearer.

2. Anonymous classes

Another sample of code folding is when anonymous classes definition is replaced with the lambda notation added in Java 8. The lambda notation makes the code much shorter.

When you move the mouse over this or any other folded piece of code, you can still see the original code.

3. Folding settings

You can always change the default behavior of code folding for particular statements via SettingsEditorCode Folding.

4. Other useful actions

  • Expand All via Shift + Ctrl + + (Shift + Cmd + + for Mac) automatically expands all collapsed blocks in the opened file.
  • No labels