commonMain.com.dshatz.fuzzykat.ToStringFunction.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fuzzyKat-jvm Show documentation
Show all versions of fuzzyKat-jvm Show documentation
Fuzzy search for Kotlin Multiplatform
The newest version!
package com.dshatz.fuzzykat
/**
* Transforms an item of type T to a String.
*
* @param The type of the item to transform.
*/
interface ToStringFunction {
/**
* Transforms the input item to a string.
*
* @param item The item to transform.
* @return A string to use for comparing the item.
*/
fun apply(item: T): String
companion object {
/**
* A default ToStringFunction that returns the input string;
* used by methods that use plain strings in [FuzzySearch].
*/
val NO_PROCESS: ToStringFunction = object : ToStringFunction {
override fun apply(item: String): String {
return item
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy