you are returning a Long object, Change your compareTo like:
@Override
public int compareTo(appointment o) {
return this.gettimeofappt().compareTo(o.gettimeofappt() );
}
Long.compareTo
compares two Long objects numerically, and Retunrs:
the value 0 if this Long is equal to the argument Long; a value less than 0 if this Long is numerically less than the argument Long; and a value greater than 0 if this Long is numerically greater than the argument Long (signed comparison).