← Back to team overview

dhis2-devs-core team mailing list archive

Diamond operator

 

Hi everyone

I have now replaced all usage of explicit types in Collections with the
diamond operator from Java 7, this should be used instead of explicit type
declaration or Guava where possible.


For example:
List<String> strings = new ArrayList<String>();

can now be replaced by

List<String> strings = new ArrayList<>();

The type of right side is inferred from the left side.

Please remember to have the <> (diamond), if you leave it out, you are left
with a raw type.

(you are of course free to still use the old variant, but there really is
no need, and it makes the code a bit easier to read)

--
Morten