keysByPrefix abstract method

TTIterable<String> keysByPrefix(
  1. String prefix, {
  2. int maxPrefixEditDistance = 0,
})

Iterates through TTMultiMap keys such that only keys prefixed by keyMapping(prefix) are included.

  • If keyMapping(prefix) is empty then returns empty Iterable.
  • If maxPrefixEditDistance > 0 then search will expand to all keys whose prefix is within a Hamming edit distance of maxPrefixEditDistance or less. For example searching for prefix 'cow' with maxPrefixEditDistance = 2 may give: cow,cowboy, chicken, crocodile, canary, cat, dog, donkey, goat, hawk, horse, zonkey

Results are ordered by key as:

  1. Results where key is prefixed by prefix (i.e. prefixEditDistance == 0) ordered lexicographically.
  2. Results of increasing edit distance ordered lexographically.

Throws ArgumentError if prefix is empty or null.

Implementation

TTIterable<String> keysByPrefix(String prefix,
    {int maxPrefixEditDistance = 0});