This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Generics Doubt

 
Timothy Sam
Ranch Hand
Posts: 751
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys! Is this declaration perfectly legal? Thanks!

List<Integer> ls1 = new LinkedList();
 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi guys! Is this declaration perfectly legal? Thanks!

List<Integer> ls1 = new LinkedList();


Hi Sam,

Yeah that is legal, but with compile time warning. ls1 is typesafe reference variable of List parameterized with Integer and on the right hand
side you are creating non type safe LinkedList;

Assigning unsafe object to typesafe reference variable gives compiler warning.



Regards,
cmbhatt
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic