• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Best way to do generics?

 
Kousik Majumder
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have a query. Suppose I have code for java 1.4 as below.



I want to make it generic to comply with Java 1.5

What is the best way and why?

a)
or
b)
 
Campbell Ritchie
Sheriff
Pie
Posts: 50173
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the code works, why do you need to change it?
 
Kousik Majumder
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it is the requirement. That is why.
 
Rob Spoor
Sheriff
Pie
Posts: 20661
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are the map values instances of Comparable<Object> I'd say probably not. String for instance isn't, it's Comparable<String>.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic