Notes on implementing concise calls to constructors with type parameters
Ulf.Zibis at gmx.de
Thu May 14 06:53:55 PDT 2009
Hm, precisely I meant, if there is any difference in the instantiated
object, and it's behaviour. Is it?
I think, LHS defines precisely the variables type, it's typesafe usage
and methodical behaviour, regardless which constructor of which type
instantiated it, so typesafety only matters for later usage of the
variable as typesafeness of RHS doesn't matter after that code line, and
we can define the shortcut as legal, to avoid the compiler warning.
Am 13.05.2009 20:00, Neal Gafter schrieb:
> The first creates a raw ArrayList, and then invokes the unchecked
> conversion (and generating the required warning from the compiler).
> The second form is typesafe.
> On Wed, May 13, 2009 at 10:58 AM, Ulf Zibis <Ulf.Zibis at gmx.de
> <mailto:Ulf.Zibis at gmx.de>> wrote:
> BTW 1 question:
> Is there any difference in writing:
> List<String> l = new ArrayList();
> List<String> l = new ArrayList<String>();
> I guess not, so why using 2nd writing.
More information about the coin-dev