Matthias Braun Matthias Braun - 1 year ago 117
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 Source

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

intellij settings

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download