Formatting array initializers with Eclipse

Is there any way to instruct the Eclipse format to put each value in an array initializer on a new line?

+7
source share
2 answers

You can do this as follows: windows / preferences / java / code style / formatter, then click edit next to the selected active profile

then on the line packaging tab

Choose Expressions → Array Initializers

In the list, select "Wrap all items, each item a new line"

+17
source

Go to windows / preferences / style java / code / formatter, and then left-click on the selected active profile, then on the "New Lines" tab there are 2 options.

+1
source

All Articles