Skip to content

Commit 69b1b20

Browse files
committed
perf improvement
1 parent e52b7d8 commit 69b1b20

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

library/src/main/java/dev/olog/contentresolversql/ContentResolverExtension.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,11 @@ fun ContentResolver.querySql2(
125125
}
126126
}
127127

128-
internal fun createKeywords(query: String): List<Pair<String, Int>> {
129-
return keywords.map { it to query.indexOf(it, ignoreCase = true) }
128+
internal inline fun createKeywords(query: String): List<Pair<String, Int>> {
129+
return keywords.asSequence()
130+
.map { it to query.indexOf(it, ignoreCase = true) }
130131
.filter { it.second > -1 }
132+
.toList()
131133
}
132134

133135
internal inline fun sanitize(keywords: List<Pair<String, Int>>) {

0 commit comments

Comments
 (0)