Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #25810
| From | Owen Jacobson <angrybaldguy@gmail.com> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Message-ID | <2011020510462785394-angrybaldguy@gmailcom> (permalink) |
| References | <iii71v$3ud$1@lust.ihug.co.nz> <iiiqnu$ev4$1@lust.ihug.co.nz> <iijr30$7a4$3@news.eternal-september.org> |
| Subject | Re: Why ?new?? |
| Date | 2011-02-05 10:46 -0500 |
On 2011-02-05 10:41:20 -0500, Joshua Cranmer said: > On 02/05/2011 01:29 AM, Lawrence D'Oliveiro wrote: >> In message<iii71v$3ud$1@lust.ihug.co.nz>, Lawrence D'Oliveiro wrote: >> >>> How many hundreds of times a day do Java programms write something like >>> >>> classname varname = new classname(args); >> >> And this just gets worse with generic types, e.g. >> >> GenericClass<Type1, Type2> x = new GenericClass<Type1, Type2>; > > And Java 7's Project Coin introduced the diamond notation for those > people who really can't type (or adhere strictly to 80-character line > widths): > GenericClass<Type1, Type2> x = new GenericClass<>(); > > But even then, it really doesn't matter that much since you can easily > get a macro in any competent IDE to fill in the LHS of that expression > for you if you really, really, really want to save keystrokes. Note that this is only useful when the initialization expression has exactly the type parameters of the declaration. In cases like Set<? extends Number> numbers = new HashSet<Integer>(); the <> shorthand (and almost any other proposed shorthand, including, unfortunately, inference by flow analysis) is of no use. -o
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
Why “new”? Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-02-05 13:53 +1300
Re: Why ?new?? Owen Jacobson <angrybaldguy@gmail.com> - 2011-02-05 10:46 -0500
Re: Why “new”? Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-02-05 19:29 +1300
Re: Why “new”? Lew <noone@lewscanon.com> - 2011-02-05 09:22 -0500
Re: Why “new”? Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-02-05 10:41 -0500
Re: Why “new”? Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-02-04 23:43 -0500
Re: Why “new”? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-02-05 09:31 -0400
Re: Why “new”? Daniele Futtorovic <da.futt.news@laposte.net.invalid> - 2011-02-05 18:43 +0100
Re: Why “new”? Arne Vajhøj <arne@vajhoej.dk> - 2011-02-04 20:05 -0500
Re: Why “new”? "Mike Schilling" <mscottschilling@hotmail.com> - 2011-02-04 17:33 -0800
Re: Why “new”? Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-02-05 14:53 +1300
Re: Why “new”? Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-02-05 14:24 +1300
Re: Why “new”? Lew <noone@lewscanon.com> - 2011-02-04 23:47 -0500
Re: Why “new”? Daniele Futtorovic <da.futt.news@laposte.net.invalid> - 2011-02-05 02:09 +0100
csiph-web