Skip to content

Commit 4ebcaba

Browse files
Make findBy() inline
1 parent 194ed6e commit 4ebcaba

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/main/kotlin/KotlinFunctionLibrary.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ println("workingList2=$workingList2")*/
916916
* Similar to [Iterable.maxBy], but with a specific object in mind.
917917
* @sample listOf<Foo>(...).findBy(bar) { it.bar }
918918
* */
919-
fun <T, R> Iterable<T>.findBy(key: R, selector: (T) -> R): T? = find { selector(it) == key }
919+
inline fun <T, R> Iterable<T>.findBy(key: R, selector: (T) -> R): T? = find { selector(it) == key }
920920

921921

922922
/**

0 commit comments

Comments
 (0)