I would like some of the Java code snippets to be formatted more compactly than the default behavior for Netbeans, however I could not set the Netbeans formatting options for the code snippets below, so I will try to ask here:
1 / Is it possible to set Netbeans formatting to leave the single line method as it is? For instance:
public void printMessage(String message) { System.out.println(message); }
the default behavior formats this snippet, as shown below:
public void printMessage(String message) {
System.out.println(message);
}
2 / Is it possible for a double curly bracket to be initialized in this form?
private List<String> list = new ArrayList<String>() {{
}};
Netbeans always breaks this code into
private List<String> list = new ArrayList<String>() {
{
}
};
Thanks for the tips.
source
share