java - Diamond operator for return value -
Does it work with Thanks. No, the boilerplate code is used to avoid the diamond, twice by the generics: Java 6: Java 7 equivalent: but in your example Diamond Operator declares to accept the "original generic" type correctly, So it will not be compiled. Java 7 ? (I just have Java 6 installed.)
list & lt; & Gt; Customers = service.getCustomers (); // gives the list & lt; Customers & gt;
list & lt; List & lt; String & gt; & Gt; MyList = new array list & lt; List & lt; String & gt; & Gt; ()
list & lt; List & lt; String & gt; & Gt; MyList = new ArrayList & lt; & Gt; () // means that the generic is the same one which is on the left of the declared declaration
Comments
Post a Comment