40 columns |
>>> all fit on one line
foo() {}
<<<
foo() {}
>>> prefer to split between params even when they all fit on next line
longFunctionName() {}
<<<
longFunctionName() {}
>>> split before first if needed
longFunctionName() {}
<<<
longFunctionName<
FirstTypeParameterIsLong, S>() {}
>>> split in middle if fit in two lines
longFunctionName() {}
<<<
longFunctionName() {}
>>> split one per line if they don't fit in two lines
veryLongFunctionName() {}
<<<
veryLongFunctionName<
First,
Second,
Third,
Fourth,
Fifth,
Sixth,
Seventh>() {}
>>> split both type and value arguments
lengthyMethodName(first, second, third, fourth, fifth, sixth, seventh, eighth) {}
<<<
lengthyMethodName<
First,
Second,
Third,
Fourth,
Fifth,
Sixth,
Seventh,
Eighth>(
first,
second,
third,
fourth,
fifth,
sixth,
seventh,
eighth) {}
>>> type parameters and => body
longFunctionName() => body;
<<<
longFunctionName() =>
body;
>>> type parameters, value parameters, and => body
longFunctionName(longParameter1, longParameter2) => body;
<<<
longFunctionName(
longParameter1,
longParameter2) =>
body;
>>> generic function typed parameter
longFunctionName(String longParameterName(LongTypeParameter parameter, AnotherTypeParam another)) {;}
<<<
longFunctionName(
String longParameterName<
LongTypeParameter,
AnotherTypeParam>(
LongTypeParameter parameter,
AnotherTypeParam another)) {
;
}