Skip to content

Instantly share code, notes, and snippets.

@timendez
Created January 5, 2024 19:27
Show Gist options
  • Save timendez/37058e8c10255fd23f43b6d1562d68d4 to your computer and use it in GitHub Desktop.
Save timendez/37058e8c10255fd23f43b6d1562d68d4 to your computer and use it in GitHub Desktop.
Polyfill different Kotlin things
fun <T> MutableSet<T>.pop(numToPop: Int): List<T> = this.take(numToPop).also { it.map { valueToRemove -> this.remove(valueToRemove) } }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment