All Downloads are FREE. Search and download functionalities are using the official Maven repository.

au.id.tmm.utilities.collection.syntax.SeqOps.scala Maven / Gradle / Ivy

There is a newer version: 0.4.7
Show newest version
package au.id.tmm.utilities.collection.syntax

import scala.collection.BuildFrom

final class SeqOps[C[_], A] private[syntax] (
  seq: C[A],
)(implicit
  buildFrom: BuildFrom[C[A], A, C[A]],
  ev: C[A] <:< Seq[A],
) {
  def everyNth(n: Int): C[A] =
    buildFrom.fromSpecific(seq)(Range(0, seq.length, n).iterator.map(i => seq.apply(i)))
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy