package blitz.collections fun MutableList.removeFirst(count: Int) { repeat(count) { removeFirst() } } fun MutableList.removeFirstInto(count: Int, dest: MutableList = mutableListOf()): MutableList { repeat(count) { dest.add(removeFirst()) } return dest } fun MutableList.removeLast(count: Int) { repeat(count) { removeLast() } } fun MutableList.removeLastInto(count: Int, dest: MutableList = mutableListOf()): MutableList { repeat(count) { dest.add(removeLast()) } return dest } fun MutableList.addFront(value: T) = add(0, value)