aspose file tools*
The moose likes Java in General and the fly likes Best way to do generics? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Best way to do generics?" Watch "Best way to do generics?" New topic
Author

Best way to do generics?

Kousik Majumder
Ranch Hand

Joined: Sep 30, 2007
Posts: 234
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)


Thanks in Advance,
Kousik
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40064
    
  28
If the code works, why do you need to change it?
Kousik Majumder
Ranch Hand

Joined: Sep 30, 2007
Posts: 234
it is the requirement. That is why.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19794
    
  20

Are the map values instances of Comparable<Object> I'd say probably not. String for instance isn't, it's Comparable<String>.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Best way to do generics?