234 l = new ArrayList<>();

Do we have a consensus on whether diamond can be used here? i.e.
assignment not on declaration.

Waiting for someone's input on this. In retrospect, I feel this is not
exactly how the diamond operator is meant to be used when I refer to
http://download.oracle.com/javase/7/docs/technotes/guides/language/type-inference-generic-instance-creation.html,
although this particular situation has not been commented upon.

Some time ago when Stuart applied diamond to all TL codes, I remember we agreed on several rules:

If the declaration and assignment are on one line, we use diamond, say

    Map<String> map = new HashMap<>();

If not, we don't, so that people needn't go back to the declaration line to find out what the parameters are, say

   Map<String> map;
   ....
   map = new HashMap<String>();

So this is mainly a coding-style thing.

-Max



Thanks,
Kurchi

Reply via email to