Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to make all collections(List,Map..etc..) type safe in java?

 
alpesh helwatkar
Ranch Hand
Posts: 30
Eclipse IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to make all collections(List,Map..etc..) type safe in java?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By using generics ? But I don't know exactly what you are asking for
 
Lalit Mehra
Ranch Hand
Posts: 384
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

as Sir Christopher said ... by using generics ... try using java 6.0 or above

generics will help you type safe what content you put into it .... but still make sure the polymorphism doesn't breaks your code ... use generics efficiently
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lalit Mehra wrote: try using java 6.0 or above

Generics are introduced in Java 1.5 itself
 
Lalit Mehra
Ranch Hand
Posts: 384
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oops ... my mistake ...
 
alpesh helwatkar
Ranch Hand
Posts: 30
Eclipse IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks a lot for the response.. observably i am a newbie to generics.. never had to use them in my previous project!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic