diff --git a/src/main/java/typeahead/Completions.kt b/src/main/java/typeahead/Completions.kt index 4c30c18..b28aeaf 100644 --- a/src/main/java/typeahead/Completions.kt +++ b/src/main/java/typeahead/Completions.kt @@ -26,7 +26,7 @@ fun NavigableSet.complete(input: String): List { // ] val canonicalisedInput = input.toLowerCase() - val seq = sequenceOf(canonicalisedInput.lastIndex + 1 downTo 0).map { + val seq = (canonicalisedInput.lastIndex + 1 downTo 0).asSequence().map { canonicalisedInput.substring(0, it) to canonicalisedInput.substring(it) } fun NavigableSet.query(s: String) = tailSet(NGram(s)).headSet(NGram(s + Char.MAX_SURROGATE))