I use the Eclipse formatter with the option on save enabled.
Right now code like this:
int sum = widgets.stream()
.filter(b -> b.getColor() == RED)
.mapToInt(b -> b.getWeight())
.sum();
will be formatted to:
int sum = widgets.stream().filter(b -> b.getColor() == RED).mapToInt(b -> b.getWeight())
.sum();
is there a setting which will do automated linebreak for everything but cascading function calls?
Steps to format cascading function calls:
1. Window => Preferences => Java => Code Style => Formatter
2. Click Edit.
3. Expand Line Wrapping => Wrapping Settings => Function Calls
4. Change Qualified invocations to Wrap all elements, except first element if not necessary.
See image below for what it looks like when set correctly:
5. Change Profile Name if necessary.
6. Apply and close.