Jul 06 2007

Neal Gafter’s proposal for constructor type inference

Tags: , Rajiv @ 1:59 pm UTC

Neal gafter has proposed that java language include Constructor Type Inference in order to reduce verbosity. So what was

Map<String,List<Thing>> map = new HashMap<String,List<Thing>>();

looks like:

Map<String,List<Thing>> map = new HashMap<>();

Though there is an alternate proposal to deduce the LHS type instead, like:

map := new HashMap<String,List<Thing>>();

I find Neal’s proposal more appealing and more natural to java. It feels so Java, that I have already used it thrice since morning only to be surprised by IDEA’s warnings! So, if anyone is counting votes, +1 from me.

Share:
  • email
  • del.icio.us
  • DZone
  • Technorati
  • Reddit
  • Ma.gnolia
  • Google Bookmarks
  • YahooMyWeb
  • SphereIt
  • StumbleUpon
  • Digg
  • Mixx
  • TwitThis
  • Furl
  • Simpy

No trackbacks

3 comments


  1. Neal Gafter


    That makes it 1 pro 0 con.

  2. Jed


    2 Pros


  3. alex


    what if
    HashMap a();
    compiled exactly as
    HashMap a = new HashMap ();
    ?
    alex

Leave a Reply

Subscribe to comments on this post

Allowed tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>