Matthias Braun Matthias Braun - 4 months ago 44
Java Question

Empty lambda expression on same line

Per default, IntelliJ 15.0.3 puts the closing brace of an empty lambda expression on the next line when reformatting the code.

Consumer<String> myFunc= aString -> {
};


In my opinion this is slightly detrimental to code readability and I want to keep the empty lambda expression on the same line:

Consumer<String> myFunc= aString -> {};


Where can I find the setting to change this?

Answer

It's in Settings (shortcut is Strg+Alt+S) underEditorCode StyleJavaWrapping and BracesKeep when reformattingSimple lambdas in one line:

intellij settings