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

Can someone check my comments to make sure I understand what is going on?

Sorry the last couple of lesson have been pretty confusing and I don't think I'm really grasping the concepts. Thank you sorry I know this is a lot

@Override /* We are again changing an object class method to fit our needs */ 
  public int compareTo(Object obj) {  /* We are comparing the inputed object to see if we can make it a Treet, zero means that the two classes are the same */ 
   Treet other = (Treet) obj; /* We are converting the inputted data into a Treet class so we can store information inside of it*/
    if (equals(other)) { /* If the newly created class is equal to the rest than the compare to value is 0, or equal*/
      return 0;
      }
    int dateCmp = mCreationDate.compareTo(other.mCreationDate); /* We are placing the other Treet class with the other Treets and keeping the array in chronological order */            
    if (dateCmp == 0) {
      return mDescription.compareTo(other.mDescription); /* If two Treets were created at the same time, then the one with the least number of words is placed before the other */
    }
    return dateCmp;
  }

public String[] getWords() { /* We are creating an array of Strings in each Treet called getWords */
    return mDescription.toLowerCase().split("[^\\w#@']+"); 
    /* We are taking the letters in the Treet's description and setting them all to lowercase. 
    We are only including the words, hashtags, apostrophes and @ 
    in each Tweet */
  }

 Treet[] treets = {secondTreet, treet}; /* We are creating an array to keep our Treets inside */
    Arrays.sort(treets); /* Thanks to the compareTo method method we can sort the Treets in our array into chronological order */
    for (Treet exampleTreet : treets) { /* For each Treet class in our array, print out the information */
      System.out.println(exampleTreet);
    }