keywordPostingsList method

List<MapEntry<String, double>> keywordPostingsList([
  1. Iterable<String>? keywords
])

Returns the list of all the MapEntry<String, double> for the keywords from the KeywordPostingsMap.

Returns all the MapEntry<String, double> instances for all keywords in the KeywordPostingsMap if keywords is null.

Implementation

List<MapEntry<String, double>> keywordPostingsList(
    [Iterable<String>? keywords]) {
  final List<MapEntry<String, double>> keywordPostings = [];
  if (keywords != null) {
    for (final keyword in keywords) {
      final entry = this[keyword];
      if (entry != null) {
        keywordPostings.addAll(entry.entries);
      }
    }
  } else {
    for (final entry in values) {
      keywordPostings.addAll(entry.entries);
    }
  }
  return keywordPostings;
}