removeFirstInto() and removeLastInto(); bump to 0.7
This commit is contained in:
@@ -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) {
|
||||
repeat(count) {
|
||||
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