TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
 
TIOBE - Java Coding Standard
Search

TypeResolution2Checked automatically with code checker

Synopsis:Use the diamond operator to let the type be inferred automatically


Description:
Use the diamond operator to let the type be inferred automatically. With the Diamond operator it is possible to avoid duplication of the type parameters. Instead, the compiler is now able to infer the parameter types for constructor calls, which makes the code also more readable.
List strings = new ArrayList(); // unnecessary duplication of type parameters List stringsWithDiamond = new ArrayList<>(); // using the diamond operator is more concise