Looking at GenericWhitespaceCheck in Checkstyle docs,
Left angle bracket (
<
):
- should be preceded with whitespace only in generic methods definitions.
- should not be preceded with whitespace when it is precede method name or following type name.
- should not be followed with whitespace in all cases.
Right angle bracket (
>
):
- should not be preceded with whitespace in all cases.
- should be followed with whitespace in almost all cases, except diamond operators and when preceding method name.
I am not sure I fully understand the reasoning behind why <
should not be followed by a space and why >
should not be preceded by one.
In other words, why is Map<String>
the convention over Map < String >
?
Is this only because as the number of parameters and depth increases it, the without spaces version is more readable.
Like, Map<String, List<String>>
is more readable than, Map < String, List < String > >
?
Also as a general question is there some repository/guides which explains reasons behind Checkstyle conventions ?