Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

hi all

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi can anybody please explain the Comparable and Comparator interface?
 
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What exactly would you like to know beyond the facts detailed in the Javadoc documentation for Comparable and Comparator?
 
Ranch Hand
Posts: 341
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
mamtaR roy,
Welcome to JavaRanch.

Please take time to choose the subject line. It makes good sense if it something relevant e.g. for this post "Comparable vs Comparator" or "What is the difference between comparable and comparator" makes more sense.
Hope you have a wonderful time here.Wish you good luck.

In short we may say, comparator is used to compare two different objects. and comparable allows itself to compare with another similar object.

A ver good explanation can be seen on this blog.

Hope that helps.
[ March 13, 2008: Message edited by: Anubhav Anand ]
 
Weeds: because mother nature refuses to be your personal bitch. But this tiny ad is willing:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic