removeFirstInto() and removeLastInto(); bump to 0.7

This commit is contained in:
alexander.nutz
2024-03-28 18:42:48 +01:00
parent f9ddfcc4a7
commit 92ca21d531
3 changed files with 16 additions and 2 deletions

View File

@@ -24,7 +24,7 @@ repositories {
} }
dependencies { dependencies {
implementation("me.alex_s168:blitz:0.6") implementation("me.alex_s168:blitz:0.7")
} }
``` ```

View File

@@ -5,7 +5,7 @@ plugins {
} }
group = "me.alex_s168" group = "me.alex_s168"
version = "0.6" version = "0.7"
repositories { repositories {
mavenCentral() mavenCentral()

View File

@@ -6,8 +6,22 @@ fun <T> MutableList<T>.removeFirst(count: Int) {
} }
} }
fun <T> MutableList<T>.removeFirstInto(count: Int, dest: MutableList<T> = mutableListOf()): MutableList<T> {
repeat(count) {
dest.add(removeFirst())
}
return dest
}
fun <T> MutableList<T>.removeLast(count: Int) { fun <T> MutableList<T>.removeLast(count: Int) {
repeat(count) { repeat(count) {
removeLast() removeLast()
} }
} }
fun <T> MutableList<T>.removeLastInto(count: Int, dest: MutableList<T> = mutableListOf()): MutableList<T> {
repeat(count) {
dest.add(removeLast())
}
return dest
}