Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
    Bookmark Topic Watch Topic
  • New Topic

Can 1 same comparator works for Double and String object type's like this ?

 
Amandeep Singh
Ranch Hand
Posts: 850
  • Mark post as helpful
  • send pies
  • Report post to moderator
this was my original comparator. And it is working.




As my requirements came in, what i did is added a new BOLD code as shown below.

Is it a right thing to do or better i should create a new Comparator ? My old comparator code is for Double value's and my new code added
is for String. Please i don't want to modify the existing code.




this is the new code i added above. it will return from here only when condition comes for my code

 
Rob Spoor
Sheriff
Pie
Posts: 20605
60
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please Use One Thread Per Question. Continuing here.
 
    Bookmark Topic Watch Topic
  • New Topic