Class

io.chymyst.jc.Core

SeqWithExtraFoldOps

Related Doc: package Core

Permalink

implicit final class SeqWithExtraFoldOps[T] extends AnyVal

Linear Supertypes
AnyVal, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. SeqWithExtraFoldOps
  2. AnyVal
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new SeqWithExtraFoldOps(s: Seq[T])

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def findAfterMap[R](f: (T) ⇒ Option[R]): Option[R]

    Permalink

    A find that will return the first value for which f returns Some(...).

    A find that will return the first value for which f returns Some(...).

    This is an optimization over find: it does not compute the found value f(r) twice.

    R

    Type of the return value r under Option.

    f

    Mapping function.

    returns

    Some(r) if f returned a non-empty option value; None otherwise.

  6. def flatFoldLeft[R](z: R)(op: (R, T) ⇒ Option[R]): Option[R]

    Permalink

    "flatMap + foldLeft" will perform a foldLeft unless the function op returns None at some point in the sequence.

    "flatMap + foldLeft" will perform a foldLeft unless the function op returns None at some point in the sequence.

    R

    Type of the return value r under Option.

    z

    Initial value of type R.

    op

    Binary operation, returning an Option[R].

    returns

    Result value Some(r), having folded to the end of the sequence. Will return None if op returned None at any point.

  7. def getClass(): Class[_ <: AnyVal]

    Permalink
    Definition Classes
    AnyVal → Any
  8. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  9. def orderedMapGroupBy[R, S](f: (T) ⇒ R, g: (T) ⇒ S): IndexedSeq[(R, IndexedSeq[S])]

    Permalink

    A standard Seq#groupBy produces a Map and loses the ordering present in the original sequence.

    A standard Seq#groupBy produces a Map and loses the ordering present in the original sequence. Instead, orderedMapGroupBy produces a sequence of tuples that preserves the ordering of the original sequence. The result is not a true groupBy since it never reorders sequence elements.

    This is suitable for stream processing or for cases when the original sequence is sorted, and we need to split the sorted sequence into sorted subsequences.

    For example, Seq(1,2,3,4).orderedMapGroupBy(x < 3) yields Seq((true, Seq(1,2)), (false, Seq(3,4)) and Seq(1,2,3,2,1).orderedMapGroupBy(x < 3) yields Seq((true, Seq(1,2)), (false, Seq(3)), (true, Seq(2,1)))

    R

    Type of the grouping key.

    S

    Type of the elements of the resulting sequence.

    f

    A function that determines the grouping key.

    g

    A function that is applied to elements as a map.

    returns

    Sequence of tuples similar to the output of groupBy.

  10. val s: Seq[T]

    Permalink
  11. def toString(): String

    Permalink
    Definition Classes
    Any

Inherited from AnyVal

Inherited from Any

Ungrouped