SeqExtensions

ostrat.SeqExtensions
class SeqExtensions[A](thisSeq: Seq[A])

Extension methods for the Seq[A] class. These are bought into scope by the seqToImplicit method in the package object.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def addOpt(optEl: Option[A]): Seq[A]
def fHead[B](ifEmpty: => B, fNonEmpty: A => B): B

This method and "headOnly" method on TraversableImplicit removes the need for headOption in the majority of case. Use head Only if you are only interested in the head value

This method and "headOnly" method on TraversableImplicit removes the need for headOption in the majority of case. Use head Only if you are only interested in the head value

Attributes

def fLast[B](ifEmpty: => B, fNonEmpty: A => B): B
def filterMap[B](fFilter: A => Boolean, fMap: A => B): Seq[B]
def foldMax[B](f: A => B)(implicit cmp: Ordering[B]): B
def foldMin[B](f: A => B)(implicit cmp: Ordering[B]): B
def foldMinMax[B](f: A => B)(implicit cmp: Ordering[B]): (B, B)
def ifAppend[B >: A](b: Boolean, elems: B*): Seq[B]

This needs to be changed to by name parameters when by name varargs are allowed. I think this is coming in 12.3

This needs to be changed to by name parameters when by name varargs are allowed. I think this is coming in 12.3

Attributes

def lenStr: String
def mapBy2[B](f: (A, A) => B): List[B]

groups the Sequence into pairs and then maps over them. Throws exception if seq.length.isOdd

groups the Sequence into pairs and then maps over them. Throws exception if seq.length.isOdd

Attributes

def mapFirstGood[B](f: A => EMon[B], errs: => Bad[B]): EMon[B]
def mapMinMaxStr[B](f: A => B)(implicit cmp: Ordering[B]): String
def mapSpec[B, BB <: Arr[B]](f: A => B)(implicit ev: BuilderArrMap[B, BB]): BB

Specialised map to an immutable ArrImut for type B.

Specialised map to an immutable ArrImut for type B.

Attributes

def next(currEl: A): A
def prev(currEl: A): A
def valueProducts[AA <: Arr[A]](implicit ev: BuilderArrMap[A, AA]): AA

Converts this sequence to a specialised ArrImut for the type.

Converts this sequence to a specialised ArrImut for the type.

Attributes