• 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

Still not getting working of compareTo() method

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
/*WHEN COMPARETO () METHOD IS CALLED FOR ADDING THE SECOND ELEMENT IN THE TREESET WHICH OBJECT VALUE IS COMPARED TO WHICH OBJECT VALUE.
*/



 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This code is very hard to understand. Please use the CODE tag when displaying code. Trying to post it normally strips the indentation and leads to character escape problems
 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The code is unclear because of " words, so please use Code Tags [co de] [/co de]

saurabhthard aggarwal wrote:/* WHEN COMPARETO() IS CALLED FROM TREESET'S ADD() METHOD WHICH IS THE CALLING OBJECT AND WHICH IS THE CALLED OBJECT .
*/



ts1 - calling object
new Student() - called (passed) object


And as per your subject line, you asked about unable to understand compareTo(), Can you explain, What exactly you are unable to get ?

 
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your method should look like this....





or





It is likely that the implementation of compareTo() differs across data structures. Hope that helps!
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic