3 ms·
Java, in a few places, has optional trailing commas. That is, if your last item also has a trailing comma, that is okay. To put this into SQL notation: SELEC
by DannyB2 7y ago
Java, in a few places, has optional trailing commas. That is, if your last item also has a trailing comma, that is okay.
To put this into SQL notation:
SELECT
col1,
col2,
col3,
FROM Table
Now the columns were on separate lines, it is easy to comment/uncomment, or copy/paste columns around. just write every column with a comma at the end. But not in SQL -- just in various places in Java code. But I wish that were in SQL.
In Java enums are the first that immediately comes to mind. Every item can have a trailing comma. After the final item (and its optional comma) use a semicolon to begin class level declarations for the enum (if any) such as a custom constructor.
In Java, another example is array initializers:
int[] values = { 1, 2, 3, 4, 5, };
If those initializer items were on separate lines, it is easy to comment/remove/interchange rows because they ALL have a comma.