Created
August 17, 2018 19:03
-
-
Save josinSbazin/d4da46b0588e731be8e94a407b762375 to your computer and use it in GitHub Desktop.
Kotlin Fast For Each
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline fun <reified T> List<T>.foreach(crossinline action: (T) | |
-> Unit): Unit { | |
val size = size | |
var i = 0 | |
while (i < size) { | |
action(get(i)) | |
i++ | |
} | |
} | |
list.foreach { } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment