compareTo method

  1. @override
int compareTo(
  1. TermSimilarity other
)
override

Compares this to other, alphabetically, non-case sensitive.

Returns a negative number if this is less than other, zero if they are equal, and a positive number if this is greater than other.

Not case sensitive.

Implementation

@override
int compareTo(TermSimilarity other) {
  if (term.toLowerCase() == this.other.toLowerCase()) return 0;
  return similarity == other.similarity
      ? 0
      : similarity > other.similarity
          ? 1
          : -1;
}