Skip to content

Instantly share code, notes, and snippets.

@sliskiCode
Created November 5, 2016 14:14
Show Gist options
  • Save sliskiCode/e15dfba92f4575512e385a3a5bba2928 to your computer and use it in GitHub Desktop.
Save sliskiCode/e15dfba92f4575512e385a3a5bba2928 to your computer and use it in GitHub Desktop.
Quick dive in Kotlin extensions 5
val collection = listOf("Piotr", "Slesarew")
collection.reversedForEach(::println)
fun <T> Iterable<T>.reversedForEach(action: (T) -> Unit): Unit {
for (element in this.reversed()) action(element)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment