Search code examples
javaeclipsestylesformatter

How can I keep array elements with specific arrangement in formatter style [eclipse]


I tried to find in formatter style preferences on eclipse to keep my array elements like that image :

enter image description here

Where can I find that style to modify it? enter image description here


Solution

  • You can configure this in Line Wrapping > Wrapping settings > Other expressions > Array initializers.

    By the way, ... = new String[] { ... can be shorten here to ... = { ... (Eclipse provides a clean-up for that: Unnecessary Code > Create array with curly when possible).

    As the following image shown: enter image description here