Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java

Differences stile to compare

Hello, Look at this two methods should it be correct by changing some places???

@Override
  public int compareTo(Object obj){
    Treet other = (Treet) obj;
    if (equals(other)){
        return 0; 
    }
    int dateCmp = mCreationDate.compareTo(other.mCreationDate);

      if(dateCmp == 0){
        return mDescription.compareTo(other.mDescription); 
      }
    return dateCmp;
  }

1 Answer

Hi Araz,

In your code above you are calling compareTo inside itself. That's not going to go well!

What challenge, or course, are you trying to get through here? I'll take a look and see what we can figure out.

Steve.

Hello Steve, Thank you! its about data Structures the comparable exercize but i did it! so its okey!