Unwrapping and Removing Statements
IntelliJ IDEA lets you quickly unwrap or extract expressions from enclosing statements. This action is available for:
for, foreach, if..elseif...else, try...catch...finally, while...do, do...while, and lone braces.
XML, HTML, and JSP.
To unwrap or remove a statement
Place the caret on the expression you want to extract or unwrap.
Chooseon the main menu or press Ctrl+Shift+Delete. IntelliJ IDEA shows a popup with all the actions that are available in the current context. Statements to be extracted are displayed on the blue background, statements to be removed are displayed on the grey background.
Click the desired action or select it using the up and down arrow keys and press Enter.