Created
January 5, 2024 19:27
-
-
Save timendez/37058e8c10255fd23f43b6d1562d68d4 to your computer and use it in GitHub Desktop.
Polyfill different Kotlin things
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
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