sortBySimilarity method

List<TermSimilarity> sortBySimilarity([
  1. bool descending = true
])

Sorts the collection of SimilarityIndex instances in descending order of SimilarityIndex.similarity.

Implementation

List<TermSimilarity> sortBySimilarity([bool descending = true]) {
  final list = List<TermSimilarity>.from(this);
  if (descending) {
    list.sort(((a, b) => b.compareTo(a)));
  } else {
    list.sort(((a, b) => a.compareTo(b)));
  }
  return list;
}