scala-tessella / ring-seq   0.4.0

Apache License 2.0 Website GitHub

Extends Scala Seq with ring (circular) methods

Scala versions: 3.x 2.13 2.12

RingSeq

ring-seq Scala version support Maven Central CI Scala Steward badge

A library that adds new operations to Scala Seq for when a sequence needs to be considered circular, its elements forming a ring.

It works on any immutable / mutable Seq and sub-types.

Available for Scala 3.1.1 and 2.13.8.

Setup

Add the following dependency to your build.sbt file:

libraryDependencies += "io.github.scala-tessella" %% "ring-seq" % "0.4.0"

Then just import the RingSeq object, any collection under Seq will access the new methods.

import io.github.scala_tessella.ring_seq.RingSeq._

"RING".rotateRight(1).mkString // GRIN
List(0, 1, 2, 3).startAt(2) // List(2, 3, 0, 1)
ListBuffer(1, 3, 5, 7, 9).reflectAt(3) // ListBuffer(7, 5, 3, 1, 9)

Documentation

Usage

One usage example is provided and documented here.

Scaladoc

The Scaladoc API documentation for Scala 3 (valid for Scala 2.13 as well) can be browsed and searched here.

Website

Check the RingSeq website for more info.