We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cfbf11c commit 42ad5f8Copy full SHA for 42ad5f8
games-core/src/main/kotlin/net/zomis/games/common/GameLists.kt
@@ -1,3 +1,8 @@
1
package net.zomis.games.common
2
3
fun <T: Any> T.toSingleList(): List<T> = listOf(this)
4
+fun <T> List<T>.shifted(steps: Int): List<T> {
5
+ require(steps >= 0)
6
+ require(steps < this.size)
7
+ return this.subList(steps, this.size) + this.subList(0, steps)
8
+}
0 commit comments