code: public int compareTo(Account o) {
          if (this.isFolder() && !o.isFolder())
              return -1;
          else if (!this.isFolder() && o.isFolder())
              return 1;
  
          // First ignore case, if they equate, use case.
          int result = name.compareToIgnoreCase(o.name);
          if (result == 0)
              return name.compareTo(o.name);
          else
              return result;
      }
docs: Implements the Comparable&lt;Account&gt; interface, this is based first on if the
  account is a folder or not. This is so that during sorting, all folders are
  first in the list.  Finally, it is based on the name.
  
  @param o The other account to compare to.
  @return this.name.compareTo(otherAccount.name);