April 2018
Intermediate to advanced
910 pages
33h 21m
English
Introduced in Java 9, the diamond operator can be used with anonymous classes if the inferred data type is denotable. When a data type is inferred, it suggests that the Java Compiler can determine the data types in a method's invocation. This includes the declaration and any included arguments.
The diamond operator was introduced in Java 7 and made instantiating generic classes simpler. Here is a pre-Java 7 example:
ArrayList<Student> roster = new ArrayList<Student>();
Then, in Java 7, we could rewrite it:
ArrayList<Student> roster = new ArrayList<>();
The problem ...