Rotation and reflection
rotateRight
Returns a sequence rotated to the right.
Example
Seq(0, 1, 2).rotateRight(1) // Seq(2, 0, 1)
rotateLeft
Returns a sequence rotated to the left.
Example
Seq(0, 1, 2).rotateLeft(1) // Seq(1, 2, 0)
startAt
Returns a sequence rotated to start at circular index.
Note
Is equivalent to rotateLeft
.
Example
Seq(0, 1, 2).startAt(1) // Seq(1, 2, 0)
reflectAt
Returns a sequence reversed and rotated to start at circular index.
Note
reflectAt(-1)
is equivalent to reverse
.
Example
Seq(0, 1, 2).reflectAt() // Seq(0, 2, 1)
The source code for this page can be found here.