removeFirstInto() and removeLastInto(); bump to 0.7
This commit is contained in:
@@ -24,7 +24,7 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("me.alex_s168:blitz:0.6")
|
implementation("me.alex_s168:blitz:0.7")
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@@ -5,7 +5,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = "me.alex_s168"
|
group = "me.alex_s168"
|
||||||
version = "0.6"
|
version = "0.7"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
@@ -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
|
||||||
|
}
|
Reference in New Issue
Block a user